The container serves CSP/cache headers itself; nginx adds HSTS, gzip, and the old /posts/*.html → extensionless 301s.
60 lines
2.1 KiB
Plaintext
60 lines
2.1 KiB
Plaintext
# gogongxt.com · TLS reverse proxy in front of the noteflow container
|
|
#
|
|
# Container: ghcr.io/gogongxt/noteflow:0.3.0 published on 127.0.0.1:8080
|
|
#
|
|
# The container sends the site's CSP and cache policy itself. Do NOT add a
|
|
# second Content-Security-Policy here: browsers enforce every CSP header they
|
|
# receive, so a stale extra policy would block the site's hashed inline
|
|
# scripts and styles. This file adds only HSTS, gzip, and the old-URL 301s.
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name gogongxt.com;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2; # nginx 1.24 — no separate `http2 on;`
|
|
server_name gogongxt.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/gogongxt.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/gogongxt.com/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
server_tokens off;
|
|
|
|
# The one security header the container cannot send (it is plain http).
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
# The container serves uncompressed; gzip before the bytes hit the wire.
|
|
gzip on;
|
|
gzip_comp_level 6;
|
|
gzip_min_length 1024;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_types text/plain text/css text/xml application/xml application/json
|
|
image/svg+xml application/javascript text/javascript application/rss+xml;
|
|
|
|
# Old note URLs were /posts/<abbrlink>.html; notes are now directories.
|
|
location ~ ^/posts/([^/]+)\.html$ {
|
|
return 301 /posts/$1;
|
|
}
|
|
|
|
# Hexo's feed path, if any reader still uses it.
|
|
location = /atom.xml {
|
|
return 301 /feed.xml;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
# Range seeks in <video> should stream, not buffer through a temp file.
|
|
proxy_buffering off;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|