首页 > 其他分享 >前后端联调 多个后端 本地

前后端联调 多个后端 本地

时间:2022-11-21 10:24:35浏览次数:35  
标签:ip 前端 前后 nginx 本地 根目录 联调 localhost

操作一  

解决场景1:他人访问前端本地

前端web的项目自动启动的服务地址,

一个是localhost:端口号 和一个192.xx:端口号

 

1、修改layer工程目录中的 public\app.config.js 第一行中的localhost 为前端192的ip

2、修改 app工程目录中的 vue.config.js 中的  publicPath表达式中的  localhost  为 前端192的ip

3、若有其他错误,全局搜索localhost选择性替换

 

缺点: 提交代码时应改回localhost,分支多时切换造成不便

操作二

解决场景1:他人访问前端本地

解决场景2:前端同时联调多个后端

切换联调ip时,只需要更改nginx配置后,执行 nginx -s reload命令

优点,避免web工程反复修改请求ip和重启服务

缺点,每次需要重新登录获取新的token

 

本地启动nginx,以v1.18.0 绿色压缩包解压后为例

0、web layer和app工程根目录.env.development,配置请求地址为  127.xxx

 

 

 

1、nginx根目录\conf\nginx.conf  中  配置server agent

 

 

 

 

 

2、nginx根目录调用 cmd命令行 , 键入    

 

nginx -t

netstat -anto|findstr “8000”

nginx -s reload

tasklist | findstr nginx

 

标签:ip,前端,前后,nginx,本地,根目录,联调,localhost
From: https://www.cnblogs.com/dhjy123/p/16910517.html

相关文章