worker_processes 1;
|
|
events {
|
worker_connections 1024;
|
}
|
|
http {
|
include mime.types;
|
default_type application/octet-stream;
|
sendfile on;
|
keepalive_timeout 65;
|
|
# 当后端连接数达到上限时,新请求将进入队列等待
|
proxy_connect_timeout 5s;
|
# 限制每个后端 Worker 的队列长度
|
limit_conn_zone $server_name zone=conn_zone:10m;
|
limit_conn conn_zone 10;
|
|
# ========== 你的域名配置(直接写在 http 内部)==========
|
|
# HTTP 重定向
|
server {
|
listen 80;
|
server_name zbyt.esunsail.com;
|
return 301 https://$server_name$request_uri;
|
}
|
|
# HTTPS 配置
|
server {
|
listen 443 ssl;
|
http2 on;
|
server_name zbyt.esunsail.com;
|
|
ssl_certificate C:/inetpub/win-acme/certs/zbyt.esunsail.com/zbyt.esunsail.com.pem;
|
ssl_certificate_key C:/inetpub/win-acme/certs/zbyt.esunsail.com/zbyt.esunsail.com.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
# ssl_ciphers HIGH:!aNULL:!MD5;
|
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:...'; # 使用较新的套件
|
ssl_prefer_server_ciphers on;
|
ssl_session_cache shared:SSL:10m; # 10M共享内存,可存储约8万个会话
|
ssl_session_timeout 10m;
|
ssl_session_tickets on;
|
|
charset utf-8;
|
access_log logs/zbyt.esunsail.com.access.log;
|
error_log logs/zbyt.esunsail.com.error.log;
|
|
location / {
|
proxy_pass http://127.0.0.1:8000;
|
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_connect_timeout 60s;
|
proxy_send_timeout 60s;
|
proxy_read_timeout 60s;
|
}
|
|
location /api/ {
|
proxy_pass http://127.0.0.1:8301/;
|
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_connect_timeout 30s;
|
proxy_send_timeout 30s;
|
proxy_read_timeout 30s;
|
proxy_no_cache 1;
|
proxy_cache_bypass 1;
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
# 允许上传最大100MB的文件
|
client_max_body_size 100m;
|
}
|
|
location /health {
|
access_log off;
|
return 200 "OK\n";
|
add_header Content-Type text/plain;
|
}
|
}
|
}
|