24 lines
558 B
Nginx Configuration File
24 lines
558 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
# 前端静态文件
|
|
location / {
|
|
root /var/www/html;
|
|
index index.html;
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
|
|
# API请求代理到后端Flask应用
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:5000;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
# 健康检查端点
|
|
location /health {
|
|
proxy_pass http://127.0.0.1:5000;
|
|
}
|
|
} |