Files
anotherreflections-website-v2/nginx.conf
striker 7f85f34b6a
All checks were successful
Deploy to web.hhivp.com / deploy (push) Successful in 33s
docs(CLAUDE.md) + fix(nginx): application/rss+xml для feed.xml
- CLAUDE.md проекта: сервер, cutover-инструкция, откат за минуту,
  бэкап-пути, стек, структура, RSS-конфигурация под IPB, аналитика+consent,
  CI/CD, локальная разработка
- nginx.conf: types{} default_type application/rss+xml — теперь Content-Type
  правильный для RSS Importer (раньше отдавалось text/xml из дефолтного MIME)
2026-05-21 02:47:39 +03:00

93 lines
4.5 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# nginx-конфиг внутри контейнера (статика Astro)
# TLS терминируется на хост-уровне (web.hhivp.com), здесь только HTTP.
server {
listen 80 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Логи — на stdout/stderr контейнера (видны через docker logs)
access_log /dev/stdout;
error_log /dev/stderr warn;
# Безопасность: запрет на скрытые файлы (но разрешаем .well-known для LE)
location ~ /\.(?!well-known) {
deny all;
log_not_found off;
access_log off;
}
# ────────────────────────────────────────────────────────────────
# Сжатие
# ────────────────────────────────────────────────────────────────
gzip on;
gzip_vary on;
gzip_min_length 256;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
text/plain text/css text/xml
application/json application/xml application/rss+xml application/atom+xml
application/javascript application/x-javascript
image/svg+xml font/woff2;
# ────────────────────────────────────────────────────────────────
# MIME для RSS-фидов и текстовых служебных файлов
# ────────────────────────────────────────────────────────────────
# types{} перебивает дефолтный mime, чтобы Content-Type был application/rss+xml,
# а не text/xml (так RSS Importers в IPB точно поймут как RSS-feed).
location = /feed.xml {
types { } default_type application/rss+xml;
charset utf-8;
try_files /feed.xml =404;
expires 5m;
add_header Cache-Control "public, max-age=300, must-revalidate";
}
location ~ ^/category/[^/]+/feed\.xml$ {
types { } default_type application/rss+xml;
charset utf-8;
expires 5m;
add_header Cache-Control "public, max-age=300, must-revalidate";
}
location = /sitemap.txt {
default_type text/plain;
charset utf-8;
}
location = /robots.txt { default_type text/plain; charset utf-8; }
location = /ai.txt { default_type text/plain; charset utf-8; }
location = /llms.txt { default_type text/plain; charset utf-8; }
# ────────────────────────────────────────────────────────────────
# Кэш статики (хеш у Astro в имени файла)
# ────────────────────────────────────────────────────────────────
location /_astro/ {
expires 1y;
add_header Cache-Control "public, immutable, max-age=31536000";
access_log off;
}
location ~* \.(?:css|js|woff2?|ttf|otf|eot)$ {
expires 30d;
add_header Cache-Control "public, max-age=2592000";
access_log off;
}
location ~* \.(?:png|jpe?g|gif|svg|webp|avif|ico)$ {
expires 30d;
add_header Cache-Control "public, max-age=2592000";
access_log off;
}
# ────────────────────────────────────────────────────────────────
# Маршрутизация: trailingSlash: 'always' уже встроен в Astro,
# все страницы экспортированы как dir/index.html
# ────────────────────────────────────────────────────────────────
location / {
try_files $uri $uri/ $uri.html =404;
}
# Кастомная 404
error_page 404 /404.html;
location = /404.html { internal; }
}