dev5
By:
dev5

How to solve "internal server error"

July 19, 2017 561 views
Nginx

The server connection is showing an Internal Server Error when I access the IPv4. Running sudo tail -30 /var/log/nginx/error.log gives me:

[error] 17876#0: *14 connect() to unix:/var/www/html/site-available/socket.sock failed (111: Connection refused) while connecting to upstream, client: 94.14.168.244, 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/"

Here is the nginx default.conf

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;
}

}

This is the uwsgi.ini file

[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

Any suggestions as to how I could resolve the internal server error would be amazing. Thanks

Be the first one to answer this question.