纯静态资源跨机 Web 代理,有最佳实践吗?
資深大佬 : saytesnake 0
有个客户的环境是这样的,
A 机器为一个 Nginx 服务器,192.168.1.1 ; B 机器为一个 Spring Boot 应用服务器,前端是 Vue,前后端分离,192.168.1.2 ;
Vue 的包,客户公司的的做法都不一,有的是直接放在 A 机器上,类似,
server { listen 80; server_name localhost; location / { alias /path/vue/; index index.html; } location /app { proxy_pass http://192.168.1.2:8080; } }
有的是觉得不方便修改变更或者是没有 A 服务器的权限,就在 B 机器再安装一个 Nginx,类似,
server { listen 8000; server_name localhost; location / { alias /path/vue/; index index.html; } }
然后 A 机器便是,
server { listen 80; server_name localhost; location / { proxy_pass http://192.168.1.2:8000; } location /app { proxy_pass http://192.168.1.2:8080; } }
实际情况还比较复杂,这个有最佳实践吗?总感觉怪怪的这样…
大佬有話說 (2)