uwsgi部署

一、安装uwsgi

pip install uwsgi

二、编写uwsgi.ini

# mysite_uwsgi.ini file
[uwsgi]
daemonize = /website/AutocareBaoLei/uwsgi.log
logto = /website/AutocareBaoLei/error.log
socket = :8000
chdir = /website/AutocareBaoLei
module = AutocareBaoLei.wsgi
master = true
process = 4
vacuum = true

三、启动uwsgi

uwsgi --ini /etc/uwsgi.ini

四、nginx配置文件

upstream wsbackend {
        server 127.0.0.1:8000;
    }

    server {
        listen       80;
        server_name  www.xxx.com;
        root         /website/AutocareBaoLei;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location /static/ {
        alias /website/AutocareBaoLei/static/;
        }

        location /media/ {
        alias /website/AutocareBaoLei/media/;
        }

        location / {
            include uwsgi_params;
            uwsgi_pass wsbackend;
        }

        location /webssh/ {
            proxy_pass http://127.0.0.1:8080/webssh/;
            proxy_redirect off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

 

posted @ 2019-06-18 18:54  我在地球凑人数的日子  阅读(757)  评论(0编辑  收藏  举报