场景:
1、外网提供端口83 映射本地80
nginx 监听 80端口
访问登录界面没问题,
登录后,提示找不到login页面。
地址栏发现没有端口。如:xxx.xxx.xxx.xxx/login
2、nginx配置文件没有做带端口走 ,加入第四句代码即可
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:83; # 端口跟着走
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:6609; # 添加端口跟着走。应用登录后,链接地址就变成www.xx.com.cn:6609/login
}
本文解决Nginx配置中端口未跟随跳转导致登录界面无法正常显示的问题,通过调整配置文件加入端口号,使得应用登录后链接地址正确展示,确保用户体验。
1万+

被折叠的 条评论
为什么被折叠?



