*14 connect() 到套接字失败 111:连接到上游时连接被拒绝

*14 connect() 到套接字失败 111:连接到上游时连接被拒绝

当我通过客户端运行 nginx 时,已建立的服务器连接显示内部服务器错误。运行后sudo tail -30 /var/log/nginx/error.log显示:

[error] 17876#0: *14 connect() to unix:/var/www/html/site-available/socket.sock failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: localhost, request: "GET /favicon.ico HTTP/1.1",upstream: "uwsgi://unix:/var/www/html/site-available/socket.sock:", host: "xx.xx.xx.xx", referrer: "http://xx.xx.xx.xx/"

以下是 nginx 默认配置

server {
listen 80;
real_ip_header X-Forwarded-For;
set_real_ip_from 127.0.0.1;
server_name localhost;

location / {
    include uwsgi_params;
    uwsgi_pass unix:/var/www/html/site-available/socket.sock;
    uwsgi_modifier1 30;
}

error_page 404 /404.html;
location = /404.html {
    root /usr/share/nginx/html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/nginx/html;
}

}

这是 uwsgi.ini 文件

[uwsgi]
#application's base folder
base = /var/www/html/site-available

#python module to import
app = src.app
module = %(app)
home = %(base)/venv
pythonpath = %(base)

#socket file's location
socket = /var/www/html/site-available/socket.sock

#permissions for the socket file
chmod-socket = 777

#add more processes
processes = 8

#add more threads
threads = 8

#kill worker if timeout > 15 seconds
harakiri = 15

#the variable that holds a flask application inside the module imported at
line #6
callable = app

#location of log files
logto = /var/www/html/site-available/log/%n.log

关于如何解决内部服务器错误的任何建议都将非常有用。

相关内容