M
M
maximkalga2016-04-20 15:34:55
Django
maximkalga, 2016-04-20 15:34:55

502 Bad Gateway nginx - without any errors in the logs, sentry, website, etc. Where to look?

The first time is this: everything starts and works locally on the server (python manage.py runserver 0.0.0.0:8000), in the settings everything is also ok:

upstream arna {
    server unix:///tmp/arna.sock;
}

server {
    listen       80;
    server_name  www.arna.com;
    return       301 http://arna.com$request_uri;
}

server {

    listen      80;
    server_name arna.com;
    charset     utf-8;
    access_log /home/arna/logs/access.log;
    error_log  /home/arna/logs/error.log;

    client_max_body_size 75M;


    location /media  {
        alias /opt/arna/media;
    }

    location /static {
        alias /opt/arna/static;
    }

    location /robots.txt {
        alias /opt/arna/static/robots.txt;
    }

    location / {
        uwsgi_pass  arna;
        include     /home/arna/arna/uwsgi_params;
    }
}

[uwsgi]
chdir           = /home/arna/arna
module          = django.core.wsgi:get_wsgi_application()
home            = /home/arna/venv
env             = DJANGO_SETTINGS_MODULE=newsbot.settings
master          = true
processes       = 10
socket          = /tmp/arna.sock
logfile         = /home/arna/logs/uwsgi.log
chmod-socket    = 666
vacuum          = true

a socket is created if you write something left in the config, errors appear in the logs, and with this configuration everything is quiet, as if ok, but 502.
Where else can you look for the cause?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maximkalga, 2016-04-20
@maximkalga

The problem was in the config itself, in /etc/nginx/nginx.conf. I copied all the settings from another server and it worked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question