Files
pushkinohistory-ru-v2/nginx/pushkinohistory.ru.conf
striker 0e758f3a1a
Some checks failed
deploy / deploy (push) Failing after 9s
nginx: map по $uri (декодированному) для cyrillic legacy-slugs
2026-05-21 03:25:34 +03:00

84 lines
3.5 KiB
Plaintext
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.
# pushkinohistory.ru — Astro v2
# Container: pushkinohistory-ru-v2 (nginx:alpine + Astro SSG) on 127.0.0.1:4146
# v2 cutover: 2026-05-21 (старый WP на :4143 оставлен в /opt/docker/sites/pushkinohistory-ru как backup для отката)
# 301-редиректы со старых URL-encoded WP-cyrillic slugs на новые транслитерированные.
# $uri — URL-декодированный путь (UTF-8 cyrillic). $request_uri сохраняет percent-encoding,
# поэтому для cyrillic-slugs нужен именно $uri.
map $uri $legacy_redirect {
default "";
~^/добро-пожаловать/?$ /dobro-pozhalovat/;
~^/фото/?$ /foto/;
~^/сегодня-ночью-россияне-увидят-первое-суперлуние-года-волчью-луну/?$ /segodnya-nochyu-rossiyane-uvidyat-pervoe/;
~^/первые-20-градусные-морозы/?$ /pervye-20-gradusnye-morozy/;
# WP feed → новый Astro feed
~^/feed/?$ /feed.xml;
~^/feed/rss2/?$ /feed.xml;
}
server {
listen 80;
listen [::]:80;
server_name pushkinohistory.ru www.pushkinohistory.ru;
include /etc/nginx/templates/letsencrypt.conf;
location / { return 301 https://pushkinohistory.ru$request_uri; }
}
server {
listen 443 ssl;
listen 443 quic;
listen [::]:443 ssl;
listen [::]:443 quic;
http2 on;
server_name www.pushkinohistory.ru;
ssl_certificate /etc/letsencrypt/live/pushkinohistory.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/pushkinohistory.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/pushkinohistory.ru/chain.pem;
include /etc/nginx/templates/ssl.conf;
include /etc/nginx/templates/security-headers.conf;
include /etc/nginx/templates/rugov-block.conf;
return 301 https://pushkinohistory.ru$request_uri;
}
server {
listen 443 ssl;
listen 443 quic;
listen [::]:443 ssl;
listen [::]:443 quic;
http2 on;
server_name pushkinohistory.ru;
ssl_certificate /etc/letsencrypt/live/pushkinohistory.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/pushkinohistory.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/pushkinohistory.ru/chain.pem;
include /etc/nginx/templates/ssl.conf;
include /etc/nginx/templates/security-headers.conf;
include /etc/nginx/templates/rugov-block.conf;
include /etc/nginx/templates/letsencrypt.conf;
access_log /var/log/nginx/access/pushkinohistory.ru.access.log;
error_log /var/log/nginx/errors/pushkinohistory.ru.error.log warn;
client_max_body_size 4M;
# 301-редиректы с легаси WP-URL
if ($legacy_redirect != "") {
return 301 $legacy_redirect;
}
# WP-эндпоинты больше не существуют — 410 Gone (поисковики помечают как удалённые)
location ~* ^/(wp-admin|wp-login\.php|wp-content|wp-includes|xmlrpc\.php|wp-cron\.php|wp-config\.php|readme\.html) {
return 410;
}
# Всё остальное — на контейнер v2. Astro nginx внутри сам разруливает кэши,
# MIME для RSS, /api/news.json из bind-mount и т.д.
location / {
proxy_pass http://127.0.0.1:4146;
include /etc/nginx/templates/proxy.conf;
proxy_read_timeout 30s;
}
}