76 lines
2.2 KiB
Plaintext
76 lines
2.2 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
access_log /var/log/nginx/mining-access.log;
|
||
error_log /var/log/nginx/mining-error.log;
|
||
|
||
client_max_body_size 50M;
|
||
|
||
# 反向代理到Flask应用
|
||
location / {
|
||
proxy_pass http://mining-system:5000;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection 'upgrade';
|
||
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_cache_bypass $http_upgrade;
|
||
|
||
# AI分析可能需要较长时间
|
||
proxy_connect_timeout 600;
|
||
proxy_send_timeout 600;
|
||
proxy_read_timeout 600;
|
||
}
|
||
|
||
# 健康检查端点
|
||
location /health {
|
||
access_log off;
|
||
return 200 "OK\n";
|
||
add_header Content-Type text/plain;
|
||
}
|
||
}
|
||
|
||
# HTTPS配置(使用SSL证书时取消注释)
|
||
# server {
|
||
# listen 443 ssl http2;
|
||
# server_name your-domain.com;
|
||
#
|
||
# ssl_certificate /etc/nginx/ssl/cert.pem;
|
||
# ssl_certificate_key /etc/nginx/ssl/key.pem;
|
||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||
# ssl_ciphers HIGH:!aNULL:!MD5;
|
||
# ssl_prefer_server_ciphers on;
|
||
# ssl_session_cache shared:SSL:10m;
|
||
# ssl_session_timeout 10m;
|
||
#
|
||
# access_log /var/log/nginx/mining-ssl-access.log;
|
||
# error_log /var/log/nginx/mining-ssl-error.log;
|
||
#
|
||
# client_max_body_size 50M;
|
||
#
|
||
# location / {
|
||
# proxy_pass http://mining-system:5000;
|
||
# proxy_http_version 1.1;
|
||
# proxy_set_header Upgrade $http_upgrade;
|
||
# proxy_set_header Connection 'upgrade';
|
||
# 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_cache_bypass $http_upgrade;
|
||
#
|
||
# proxy_connect_timeout 600;
|
||
# proxy_send_timeout 600;
|
||
# proxy_read_timeout 600;
|
||
# }
|
||
# }
|
||
#
|
||
# # HTTP重定向到HTTPS
|
||
# server {
|
||
# listen 80;
|
||
# server_name your-domain.com;
|
||
# return 301 https://$host$request_uri;
|
||
# } |