我用的宝塔,直接图像化修改配置即可,其他方式部署的话修改部署的 nginx.conf 文件即可
代码
server {
listen 3001;
server_name 127.0.0.1; # 自己服务器的ip
charset utf-8;
location / {
root /www/wwwroot/feng-jop/feng-front-admin;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
# 匹配路径并转发到对应的后端地址上
location ^~ /api/ {
proxy_pass http://127.0.0.1:8081/api/; # 自己服务器的ip
}
}