一、找到nginx的配置文件
修改文件中nginx.conf
添加配置
xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
server {
listen 80; #监听端口
server_name localhost; #监听地址
location / { #请求的url过滤,正则匹配,~为区分大小写,~*为不区分大小写。
# root /Users/shaojiaxi/Desktop/web-shaojiaxi;
# index el.html;
proxy_pass http://127.0.0.1:8080/; ##修改为前端访问地址
proxy_redirect default;
}
location /api/ {
proxy_pass http://127.0.0.1:8888/;##修改为后台访问地址
proxy_redirect default;
}
}
配置完成之后,重启nginx。
前台地址就成为:localhost
后台地址就成为:localhost/api/





评论
登录后即可评论
分享你的想法,与作者互动
暂无评论