Files
vps_web/deploy/nginx-vps.ddrwode.cn.conf
ddrwode 6b309fb03f 哈哈
2026-02-10 13:57:46 +08:00

34 lines
1.3 KiB
Plaintext
Raw Permalink 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.

# 复制到服务器: /etc/nginx/sites-available/vps.ddrwode.cn
# 然后: sudo ln -sf /etc/nginx/sites-available/vps.ddrwode.cn /etc/nginx/sites-enabled/
# 先只保留下面这个 server80执行 certbot --nginx -d vps.ddrwode.cn 后会自动添加 443 和证书
# 静态资源:长缓存 + 可选 gzip若全局未开启
# 若静态由 Flask 提供,则保留 proxy_pass若改为 Nginx 直接托管,用 alias 指向项目 static 目录
server {
listen 80;
server_name vps.ddrwode.cn;
gzip on;
gzip_vary on;
gzip_min_length 256;
gzip_types text/plain text/css application/javascript application/json application/xml image/svg+xml;
# 静态资源缓存 7 天,减少重复请求与页面跳转后的再加载
location /static/ {
proxy_pass http://127.0.0.1:5001;
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;
add_header Cache-Control "public, max-age=604800";
}
location / {
proxy_pass http://127.0.0.1:5001;
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;
}
}