Add nginx config
This commit is contained in:
@@ -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
25
docker/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user