Closed AndrewLiuZhangZong closed 1 year ago
如果没有域名哪
如果没有域名该怎样配置
1、nginx映射 2、后台完整地址
无域名没关系
server { listen 3100; server_name localhost;
root /www/wwwroot/visionfile/web/dist;
location / {
# 用于配合 browserHistory使用
try_files $uri $uri/ /index.html;
}
location /jeecgboot/ {
#后台接口地址(我们部署去掉了/jeecg-boot项目名,如果你有请加上)
proxy_pass http://127.0.0.1:18080/;
proxy_redirect off;
#真实IP获取
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
set $my_proxy_add_x_forwarded_for $proxy_add_x_forwarded_for;
if ($proxy_add_x_forwarded_for ~* "127.0.0.1"){
set $my_proxy_add_x_forwarded_for $remote_addr;
}
proxy_set_header X-Forwarded-For $my_proxy_add_x_forwarded_for;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
这样配置nginx 对吗
前端配置这样的
版本号:3.5.3
问题描述:nginx 代理 pnpm build 打包后的dist,后台端口是18080
nginx配置 .env.production配置
截图&代码:
访问的时候前台没有调用18080接口的后台地址,而是还是3100前端地址,好像没有请求代理