首页 > 其他 > 详细

如何用nginx将vue部署到本地

时间:2021-05-20 15:39:35      阅读:15      评论:0      收藏:0      [点我收藏+]



server { listen
9000; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; try_files $uri $uri/ /index.html; //据说加上这个玩意 刷新页面不会404
index index.html index.htm; } location @router { rewrite
^.*$ /index.html last; } location ^~/api/ { proxy_pass http://xxx.xx.x.xx:xxxx/; //后面这个斜杠 应该是可以代替重写 proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }

这边主要是因为 打包之后,连登陆接口都访问不了,一直 404. 说实话 上面的一串玩意一个看不懂。。。。

转自: 

https://juejin.cn/post/6857787591301005320#heading-7

如何用nginx将vue部署到本地

原文:https://www.cnblogs.com/diligent-noob/p/14788676.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!