Files

80 lines
2.9 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.
# =========================================================
# an.xiaoan.xyz - 云端 Nginx(443,TLS)
#
# 放在云服务器 /etc/nginx/sites-available/an.xiaoan.xyz
# 依赖:
# - 云服务器 frps 开启 vhostHTTPPort = 80
# - frpc 的 blog_sit 代理:type="http", localPort=9001,
# customDomains=["an.xiaoan.xyz"]
# - 证书放到 /etc/nginx/ssl/an.xiaoan.xyz/
#
# 链路:
# Browser 443 -> 本 Nginx (TLS 终止) -> 127.0.0.1:80 (frps)
# -> frpc -> 内网 Nginx:9001 -> Gunicorn:8000
# =========================================================
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name an.xiaoan.xyz;
ssl_certificate /etc/nginx/ssl/an.xiaoan.xyz/an.xiaoan.xyz_bundle.pem;
ssl_certificate_key /etc/nginx/ssl/an.xiaoan.xyz/an.xiaoan.xyz.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
server_tokens off;
client_max_body_size 220m;
client_body_timeout 300s;
send_timeout 300s;
access_log /var/log/nginx/an.xiaoan.xyz.access.log;
error_log /var/log/nginx/an.xiaoan.xyz.error.log warn;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options SAMEORIGIN always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
# AI 摘要流式接口:关闭缓冲
location = /digest/stream/ {
proxy_pass http://127.0.0.1:80;
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-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Connection "";
proxy_connect_timeout 10s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_buffering off;
proxy_cache off;
}
location / {
proxy_pass http://127.0.0.1:80;
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-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Connection "";
proxy_connect_timeout 10s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_request_buffering off;
}
}