已经打包上线的vue代码怎么改_Vue 打包部署上线

1,VUE逻辑编写完成后在当前项目下打包

npm run build

需要注意的是,当打包完毕后,需要将入口的index.html的项目dist路径改成相对路径

另外需要注意的一点是,一旦打包vue.js项目,需要确保项目内必须使用vue.js语法来写功能,比如a标签要替换成, 传统的window.location.href跳转页面也要换成this.$router.push({ path: '/home/first' })这种形式。

2,建立要部署上线的前端文件夹,放入dist ,src(static),,index 三个文件

3,登录centos系统,运行 chmod 755 /root/video_vue 对项目文件授权

修改nginx 配置文件 vim /etc/nginx/conf.d/default.conf  增加下面的配置,这里前端服务默认监听80端口

//后端管理系统入口

server {

listen8000;

server_name localhost;

access_log/root/myweb_access.log;

error_log/root/myweb_error.log;

client_max_body_size 75M;

location/{

include uwsgi_params;

uwsgi_pass127.0.0.1:8001;

uwsgi_param UWSGI_SCRIPT video_back.wsgi;

uwsgi_param UWSGI_CHDIR/root/video_back;

}

location/static {

alias/root/video_back/static;

}

location/upload {

alias/root/video_back/upload;

}

error_page500 502 503 504 /50x.html;

location= /50x.html {

root/usr/share/nginx/html;

}

}//前端入库配置

server {

listen80;

server_name localhost;

access_log/root/video_vue_access.log;

error_log/root/video_vue_error.log;

client_max_body_size 75M;

location/{

root/root/video_vue;

index index.html;

}

error_log/root/video_vue/error.log error;

}

需要注意的是端口不能重复监听,所以之前的django服务需要让出80端口,改成监听8000,而uwsgi服务也需要让出8000端口改成在8001端口运行服务

4,mypro_wsgi.ini配置文件改端口(后台项目根目录下建立此文件)

[uwsgi]

chdir= /root/video_back

module=video_back.wsgi

master=true

processes= 3socket= 0.0.0.0:8001vacuum=true

pythonpath= /usr/bin/python3

daemonize= /root/video_back/uwsgi.log

5,重启nginx服务

systemctl restart nginx.service

完成访问测试

收工!!!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值