- 下载若依项目,前端后端项目本地启动
- 前端打包,后端打包
- 配置nginx.conf
需要注意的是:路径别用中文,要不然报错
#前台访问地址及端口80,在vue.config.js中可查看
server {
listen 80;
server_name localhost;
#后台访问地址http://localhost:8080/
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就是设置的代理后的地址,即自己服务器后台接口的url
proxy_pass http://localhost:8080/;
}
# root:dist静态页面根目录地址 index:dist中html文件的名字
location / {
root C:/Users/18427/Desktop/windowsBUSHUTest/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
# windows中无需配置第一行的user
- 启动nginx,访问localhost:80
参考:
- https://blog.csdn.net/qq_40183977/article/details/130001512
- https://blog.csdn.net/qq_39533140/article/details/113487899
文章来源地址https://www.toymoban.com/news/detail-612217.html
文章来源:https://www.toymoban.com/news/detail-612217.html
到了这里,关于windows下若依vue项目部署的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!