|
@@ -3,8 +3,6 @@ server {
|
|
|
listen 80; # 监听端口
|
|
listen 80; # 监听端口
|
|
|
server_name localhost; # 域名或 IP
|
|
server_name localhost; # 域名或 IP
|
|
|
|
|
|
|
|
- user root;
|
|
|
|
|
-
|
|
|
|
|
# 前端静态文件
|
|
# 前端静态文件
|
|
|
location / {
|
|
location / {
|
|
|
root /usr/share/nginx/html; # Vue/React 打包后的 dist 目录
|
|
root /usr/share/nginx/html; # Vue/React 打包后的 dist 目录
|
|
@@ -12,13 +10,15 @@ server {
|
|
|
try_files $uri $uri/ /index.html; # 支持 Vue/React 前端路由
|
|
try_files $uri $uri/ /index.html; # 支持 Vue/React 前端路由
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- alias /usr/share/nginx/html/favicon.ico;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
# 后端 API 代理
|
|
# 后端 API 代理
|
|
|
location /api/v1/ {
|
|
location /api/v1/ {
|
|
|
proxy_pass http://ruoyi.autumn.com/api/v1/; # 转发到后端服务
|
|
proxy_pass http://ruoyi.autumn.com/api/v1/; # 转发到后端服务
|
|
|
|
|
+ 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_connect_timeout 60s;
|
|
|
|
|
+ proxy_read_timeout 60s;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
# 错误页面
|
|
# 错误页面
|