手册

前后端统一端口部署

292
刘美琴
2021-12-02 19:09:49
分享链接
摘要:前后端开放统一端口访问

场景:内网开放后端端口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'
}

发表评论
评论通过审核后显示。