program/nginx.conf

48 lines
1.5 KiB
Nginx Configuration File
Raw 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.

# 智能矿山标签监测系统 - Nginx反向代理配置
# 安装到此文件: /etc/nginx/sites-available/mining-system
# 执行: ln -s /etc/nginx/sites-available/mining-system /etc/nginx/sites-enabled/
# 执行: nginx -t && systemctl reload nginx
server {
listen 80;
server_name mining.yourdomain.com; # 修改为你的域名或IP
# 日志配置
access_log /var/log/nginx/mining-system-access.log;
error_log /var/log/nginx/mining-system-error.log;
# 客户端上传大小限制
client_max_body_size 50M;
# 反向代理到Flask应用
location / {
proxy_pass http://127.0.0.1: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 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
}
# 静态文件直接由Nginx服务可选需要将static目录指向正确路径
# location /static/ {
# alias /path/to/mining-system/static/;
# expires 30d;
# add_header Cache-Control "public, immutable";
# }
# 健康检查
location /health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
}