收录 zhengquan-site 前后端完整代码:24 朝数据、24 幅权力结构图、 5 条沿革(67 节点 / 269 条细释)、44 个词条,以及部署配置与接口测试。
46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
# 舆纪历史 · 政体志
|
|
# 用法:替换域名与证书路径后,放入 /etc/nginx/conf.d/ 或 sites-available/ 并重载 Nginx。
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name zhengquan.incarnation.cn;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name zhengquan.incarnation.cn;
|
|
|
|
# 证书路径按实际签发结果修改
|
|
ssl_certificate /etc/letsencrypt/live/zhengquan.incarnation.cn/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/zhengquan.incarnation.cn/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
|
|
|
# 静态资源:缓存策略由后端按文件类型设置(JS/CSS 走 ETag 协商缓存)
|
|
location /assets/ {
|
|
proxy_pass http://127.0.0.1:5180;
|
|
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;
|
|
}
|
|
|
|
# 页面、接口与 SPA 回退
|
|
location / {
|
|
proxy_pass http://127.0.0.1:5180;
|
|
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;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
}
|