I am creating a django application using nginx as my server with uwsgi. However when i entered my domain or ip address to access my site. I got an 502 BAD GATEWAY ERROR. So I decided to look at my logs to see if i made a mistake because I was following Digital Ocean tutorial.
Nginx file
server {
listen 80;
server_name 173.212.203.105;
error_log /root/logs/error.log;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /root/muzillasite;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/muzillasite.sock;
}
}
Uwsgi ini
[uwsgi]
project = muzillasite
base = /root
chdir = %(base)/%(project)
home = %(base)/%(project)
module = %(project).wsgi:application
master = true
processes = 5
socket = %(base)/%(project)/%(project).sock
chmod-socket = 664
vacuum = true
Uwsgi conf
description "uWSGI application server in Emperor mode"
start on runlevel [2345]
stop on runlevel [!2345]
setuid root
setgid www-data
exec /usr/local/bin/uwsgi --emperor /etc/uwsgi/sites
Errors
uwsgi.service - uWSGI Emperor service
Loaded: loaded (/etc/systemd/system/uwsgi.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Sun 2017-01-15 22:57:00 CET; 2s ago
Process: 1127 ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites (code=exited, status=203/EXEC)
Process: 1122 ExecStartPre=/bin/bash -c mkdir -p /run/uwsgi; chown root:www-data /run/uwsgi (code=exited, status=0/SUCCESS)
Main PID: 1127 (code=exited, status=203/EXEC)
Error Logs
2017/01/15 21:58:51 [crit] 28840#28840: *34 connect() to unix:/run/uwsgi/muzillasite.sock failed (2: No such file or directory) while