connect() failed (111: Connection refused)

时间:2026-02-15 09:39:38

1、出现此错误提示,表明uwsgi.ini或nginx.conf有问题,导致nginx 访问uwsgi被拒绝

2、解决方法:

1、检查uwsgi.ini

[uwsgi]

socket = 127.0.0.1:8077

chdir = /root/env/demo

wsgi-file = demo/wsgi.py

processes = 2

threads = 4

chmod-socket = 664

vacuum = true

2、检查nginx.conf

server {

        listen       80 default_server;

        listen       [::]:80 default_server;

        server_name localhost;

        charset     utf-8;

        # Load configuration files for the default server block.

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

        location / {

                  root         /root/env/demo;

                  include     /etc/nginx/uwsgi_params;

                  uwsgi_pass   127.0.0.1:8077;

        }

        location /static {

                alias /root/env/ht/collected_static;

     }

        location /media {

                alias /root/env/ht/media;

     }

}

3、如果上述还不能解决问题,查看SELinux状态:

#getenforce

用于解决:failed (13: Permission denied) whileconnecting to upstream

如果SELinux status参数为enabled即为开启状态

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

© 2026 海能知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com