前端js部署

1 执行命令

1
cnpm run build

2.2 提取dist静态资源

  • 将静态资源放置后端static下   /static文件是django后端的部署文件夹

3 Nginx写入配置文件

  • 写入etc/nginx/conf.d/django.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
server {
        listen 1594;
        server_name 192.168.56.100;
                location /static {
                        alias /home/worker/opwf_project/opwf/static;
                }
 
                location / {
                        include uwsgi_params;
                        uwsgi_pass 127.0.0.1:8000;
                        uwsgi_ignore_client_abort on;
                }
}
 
server {
        listen 8889;
        server_name 192.168.56.100;
        #access_log logs/access_example.log  main;
        root /root/桌面/my_dsx/sx_01/loonview/loonview_pro/static/dist;
        location / {
                try_files $uri $uri/ @router;
        }
        location @router {
                rewrite ^.*$ /index.html last;
        }
}

4 Nginx启动

  

1
2
3
systemctl restart nginx                 # 开启nginx
tail -f /var/log/nginx/access.log       # 查看nginx接入日志
tail -f /var/log/nginx/error.log        # 查看nginx错误日志

  

5 uWSGI启动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cd /home/worker/opwf_project/uwsgi_conf
# 进入项目目录
 
uwsgi --ini uwsgi.ini
# 启动uwsgi的 django项目
# http://192.168.56.11:8888/ 访问项目
 
uwsgi --stop uwsgi.pid
# 关闭uwsgi
 
tail -f uwsgi.log
# 查看uwsgi日志
 
ps -ef|grep uwsgi
# 查看uwsgi服务是否启动
 
netstat -anptu | grep 8888     
# 查看8888端口被哪一个程序 占用
 
kill -9 端口号

  

 

posted @   睁yan-ii  阅读(528)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示