1、修改这里为空


否则报错:vue is undefined
2、修改为hash,重点:打包dist文件运行,必须这样

3、安装ngnix,重点:使用node的包:httpserve,失败


4、重点:配置代理转发

前端请求后端接口,用api前缀区分。
重点:后端地址很重要,因为没有加api,返回404,淘宝找两人解决问题,花了200rmb。
错误的配置:
location /api {
proxy_pass http://test.abc.com//;#注意这里/和不加/区别很大哟
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
正确的配置:
location /api {
proxy_pass http://test.abc.com/api/;#注意这里/和不加/区别很大哟
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
使用正确的配置后多了api的后缀,然后就不报404,成功部署。
到此耗时两天。
有点厌倦程序员的生活了,永远做不完的事情,解决不完的bug。
但是也要努力,奋斗。
