多个站点 ERROR Django uwsgi 配置问题

more than one site ERROR Django uwsgi config problem

我正在尝试 运行 多个具有 Django nginx 和 uwsgi 服务的网站。你能帮我吗? django project install aws ec2 amazon.using 80端口运行没问题 bu 使用 81 端口 错误:502 错误网关 nginx/1.14.0 (Ubuntu)

ngix 设置:

upstream app_a {
    server unix:///home/ubuntu/gym/gym.sock;
}
upstream app_b {
    server unix:///home/ubuntu/DemoGym/DemoGym.sock;
}

server {
    listen 80;
    server_name ...163;
    charset utf-8;
    client_max_body_size 20M;
    uwsgi_read_timeout 6000;
    uwsgi_send_timeout 6000;
    uwsgi_connect_timeout 6000;
    keepalive_timeout 6000;
location / {
        include /etc/nginx/uwsgi_params;
        uwsgi_pass app_a;
        root /home/ubuntu/gym;
    }
location /static/  {
        alias /home/ubuntu/gym/crm/static/;
    }
location /media/  {
        alias /home/ubuntu/gym/media/;
    }
}
server {
    listen 81;
    server_name ...163;
    charset utf-8;
    client_max_body_size 20M;
    uwsgi_read_timeout 6000;
    uwsgi_send_timeout 6000;
    uwsgi_connect_timeout 6000;
    keepalive_timeout 6000;
location / {
        include /etc/nginx/uwsgi_params;
        uwsgi_pass app_b;
        root /home/ubuntu/DemoGym;
    }
location /static/  {
        alias /home/ubuntu/DemoGym/crm/static/;
    }
location /media/  {
        alias /home/ubuntu/DemoGym/media/;
    }
}

uwsgi 设置:

[uwsgi]
plugins=python3
chdir=/home/ubuntu/gym/
home=/home/ubuntu/env/
module=mdsite.wsgi:application
master=True
gid=ubuntu
uid=ubuntu
socket=/home/ubuntu/gym/gym.sock
touch-reload=/home/ubuntu/.reload
chmod-socket=666
chown-socket=ubuntu
vacuum=True
env LANG="en-US.utf8"
env LC_ALL="en-US.UTF-8"
env LC_LANG="en-US.UTF-8"

错误:502 错误网关 nginx/1.14.0 (Ubuntu)

uwsgi 配置应放在所有应用程序下。

您打开的命令:

sudo ln -s /home/ubuntu/project_a/app_a.ini /etc/uwsgi/apps-enabled/ 

正在使用 Ubuntu