使用django,nginx,daphne将Asgi部署到ubuntu总是会导致502 Bad Gateway

我有一个运行中的django服务器,然后添加了频道后,我不得不使用asgi,我通过遵循以下步骤进行操作 this tutorial无效,然后我提到了official deployement documentation 但是永远不会碰运气502 Bad Gateway

主管配置

[program:project_name_asgi_daphne]
directory=/home/ubuntu/Lamar/
command=/home/ubuntu/env/bin/daphne -u /home/ubuntu/Lamar/daphne.sock --root-path=/home/ubuntu/Lamar/ walidproject.asgi$[program:project_name_asgi_workers]
command=/home/ubuntu/env/bin/python /home/ubuntu/Lamar/manage.py runworker
process_name=asgi_worker%(process_num)s
numprocs=1
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8
autostart=true
autorestart=true
redirect_stderr=True
stopasgroup=true

nginx配置

upstream channels-backend {
    server 0.0.0.0:8000;
}
server {
        listen 80;
        server_name 35.178.143.19;

        location /static/ {
                autoindex on;
                alias /home/ubuntu/Lamar/main/static/;
        }

        location /media {
                autoindex on;
                alias /home/ubuntu/Lamar/media/;
        }

        location / {
                proxy_pass http://channels-backend;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";


                proxy_redirect     off;
                proxy_set_header   Host $host;
                proxy_set_header   X-Real-IP $remote_addr;
                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header   X-Forwarded-Host $server_name;
        }
}
gouridetongxingzheng 回答:使用django,nginx,daphne将Asgi部署到ubuntu总是会导致502 Bad Gateway

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2404278.html

大家都在问