开发者门户UI的访问和调用的nginx配置如下(需修改的配置文件默认在${nginxInstallPath}/conf/nginx.conf):
server {
listen 8010; #端口
server_name portal; #路径
root /data/ui; #解压后ui项目所在路径
client_max_body_size 10M; #若门户端上传附件图片或资源受限时,需在此处配置文件大小的限制
location / {
try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
index index.html index.htm;
}
#对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
#因此需要rewrite到index.html中,然后交给路由在处理请求资源
location @router {
rewrite ^.*$ /index.html last;
}
location /portal/ { #portal服务端
proxy_pass http://10.22.0.160:30095/;
proxy_redirect off;
}
}
访问验证
如按上述配置,访问http://nginx所在IP:8010 ,浏览器查看是否能显示门户端首页即可。
综合运管UI的访问和调用的nginx配置如下(需修改的配置文件默认在${nginxInstallPath}/conf/nginx.conf):
server {
listen 9010;
server_name adm;
root /data/ui; #解压后ui项目所在路径
client_max_body_size 10M; #若综合运管上传附件图片或资源受限时,需在此处配置文件大小的限制
location / {
try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
index index.html index.htm;
}
#对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
#因此需要rewrite到index.html中,然后交给路由在处理请求资源
location @router {
rewrite ^.*$ /index.html last;
}
location /adm/ { #adm服务端
proxy_pass http://10.22.0.160:30096/;
proxy_redirect off;
}
location /gateway/ { #网关的govern端
proxy_pass http://10.22.0.160:9099/;
proxy_redirect off;
}
}
访问验证
如按上述配置,访问http://nginx所在IP:9010 ,浏览器查看是否能显示门户端首页即可。