[Django]-NGINX 502 bad gateway gunicorn timeout

6πŸ‘

I figured it out. In my gunicorn.service file in /etc/systemd/system/gunicorn i service.
I made a change:Added the time out. Default time out for gunicorn is 30 sec so I updated to 120.

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=lisa
Group=nginx
Restart=on-failure
WorkingDirectory=/home/lisa/revcon
ExecStart=/home/lisa/revcon/env/bin/gunicorn --**timeout 120** --workers 5 
--bind unix:/home/lisa/revcon/env.sock revcon.wsgi:application

[Install]
WantedBy=multi-user.target
~

And it worked just fine for me.

πŸ‘€Lisa

3πŸ‘

Error 502 it’s timeout for gunicorn service

[Service]
User=user
Group=www-data
WorkingDirectory=/home/user/projects/myproject/project
ExecStart=/home/user/projects/myproject/projectenv/bin/gunicorn\
                --access-logfile - \
                --workers 3 \
                --timeout 1000 \ # this
                --bind unix:/run/gunicorn.sock \
                project.wsgi:application

near error 504 it’s timeout for nginx server:

location /{
                include proxy_params;
                proxy_read_timeout 1000; # this
                proxy_pass http://unix:/run/gunicorn.sock;
        }

Leave a comment