场景:内网开放后端端口8088,前端nginx内网开放8080,需要做外网映射,但是只能映射一个端口8080
问题:如何外网访问时统一前后端端口为8080
方案:修改nginx配置和sso配置
nginx配置:
upstream api{ server 10.*.*.*:8088;//内网ip和后端端口 }
location /api { rewrite ^/api/(.*)$ /$1 break; proxy_pass http://api/; }
sso配置:
var host = window.location.protocol + "//" + window.location.hostname; window.context = { manage: host + ':8080/mvue', //管理端页面 front: host + ':8080/fvue', //前端页面 mobile: host + ':8080/mobilevue', //手机端页面 form: host + ':8080/api', portal: host + ':8080/api', bpmRunTime: host + ':8080/api', bpmModel: host + ':8080/api', uc: host + ':8080/api', mc: host + ':8080/api' }