Add nginx config

This commit is contained in:
2026-03-07 11:23:32 +03:00
parent d32269abe3
commit 6fde209464
2 changed files with 26 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
FROM nginx:stable
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY dist /usr/share/nginx/html

25
docker/nginx.conf Normal file
View File

@@ -0,0 +1,25 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# 404 fallback
error_page 404 /404.html;
# Static assets caching
location /_astro/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Redirect old article URLs (/articles/YYYY/MM/DD/slug/ -> /articles/YYYY-MM-DD-slug/)
location ~ "^/articles/(\d\d\d\d)/(\d\d)/(\d\d)/([^/]+)/?$" {
return 301 /articles/$1-$2-$3-$4/;
}
# Redirect old atom feed
location = /atom.xml {
return 301 /rss.xml;
}
}