部署

image.png

1.docker起3个容器,mysql,nginx,app

2.配置app的conf下的xxx.ini

[uwsgi]
chdir = /home/jpx/auto_cmdb/auto_cmdb
socket = 172.20.0.4:80
#http = 172.20.0.4:80

static-map = /static=/home/jpx/auto_cmdb/auto_cmdb/allstatic
module = auto_cmdb.wsgi

master = true
processes = 6

vacuum          = true

logto = /home/jpx/auto_cmdb/auto_cmdb/logs/auto_cmdb.log

3.cp应用容器内的静态文件到nginx容器内(在终端上执行)

docker cp cmdb-server:/home/jpx/auto_cmdb/auto_cmdb/allstatic/ .
docekr cp allstatic/ nginx-server:/

4.配置nginx中/etc/nginx/conf.d/default.conf

upstream django {
    server 172.21.0.2:80;      #
}                              
server {                     
    listen       172.21.0.6:80;
    server_name  nginxserver;
    charset utf-8;
    client_max_body_size 75M;
                                                      
    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
                         
    location /static {
        alias /allstatic;
    }                     
    location / {             
        uwsgi_pass django;
        include uwsgi_params;
    } 

你可能感兴趣的:(部署)