37 lines
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
# ==============================================================================
|
|
# 铁路培训实训教学平台 - Nginx 配置参考模板
|
|
# 适用于 sict 服务器 (/data2/wzb/deploy)
|
|
# ==============================================================================
|
|
|
|
server {
|
|
listen 8082; # 业务对外访问端口,可按需修改
|
|
server_name localhost;
|
|
|
|
# 1. 前端静态页面托管
|
|
location / {
|
|
root /data2/wzb/deploy/frontend;
|
|
try_files $uri $uri/ /index.html;
|
|
index index.html index.htm;
|
|
}
|
|
|
|
# 2. 后端 API 反向代理 (指向 RuoYi-Vue 后端 8092 端口)
|
|
location /prod-api/ {
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header REMOTE-HOST $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_pass http://127.0.0.1:8092/;
|
|
}
|
|
|
|
# 3. 避免静态资源缓存问题
|
|
location ~* \.(html)$ {
|
|
root /data2/wzb/deploy/frontend;
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root html;
|
|
}
|
|
}
|