第一个项目正常配置即可;访问地址:www.xxyyzz.com
第二个项目 访问地址 :www.xxyyzz.com/hdweb
1、修改静态资源访问 前缀
2、修改路由 router/index.js
3、打包完成后上传
nginx配置
location / {
root D:/nginx-1.16.1-xtces/html/xtweb;
index index.html index.htm;
}
#第二个vue项目
location /hdweb {
alias D:/nginx-1.16.1-xtces/html/hdweb/;#注意这里
index index.html index.htm;
try_files $uri $uri/ /hdweb/index.html; #解决页面刷新404问题
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_pass http://10.128.8.90:8095/;
proxy_pass http://localhost:8095/;
}
location /prod-hdapi/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8095/;
}