一、安装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 {
        }
    }

 

相关文章:

  • 2021-10-23
  • 2021-07-14
  • 2022-01-12
  • 2021-10-01
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2018-06-12
  • 2021-11-14
  • 2021-06-10
相关资源
相似解决方案