Python Django + Nginx + uwsgi 502错误网关 [英] Python Django+Nginx+uwsgi 502 Bad Gateway

查看:417
本文介绍了Python Django + Nginx + uwsgi 502错误网关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我连接到我的网站时,Centos7显示502 Bad Gateway,
我使用命令测试我的网站
uwsgi --ini
systemctl启动nginx
而且我不知道发生了什么事,请帮助我!

Centos7,when I connect to my website, shows 502 Bad Gateway,
I test my website with command
uwsgi --ini
systemctl start nginx
And I cant figure out what's happened,please help me!

这是nginx.conf

here's nginx.conf

upstream django {
  server 127.0.0.1:8000;
}

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  example.com;
    charset      utf-8;

    include /etc/nginx/default.d/*.conf;

    location / {
      include uwsgi_params;
      uwsgi_pass django;
    }

    location /static/ {
      alias /usr/local/etc/dmp/static/;
    }
}

和uwsgi设置

[uwsgi]

chdir = /usr/local/etc/dmp

module = DMP_python.wsgi

plugins = python3

socket = :8000

chmod-socket = 666

master = true

processes = 2

vacuum = true

推荐答案

您使用了错误的设置来告诉uwsgi使用HTTP端口.您需要 http-socket ,而不是socket.

You're using the wrong setting to tell uwsgi to use an HTTP port. You need http-socket rather than socket.

这篇关于Python Django + Nginx + uwsgi 502错误网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆