48 lines
1.5 KiB
Nginx Configuration File
48 lines
1.5 KiB
Nginx Configuration File
# 智能矿山标签监测系统 - 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;
|
||
}
|
||
} |