Nginx 504 Gateway Timeout Error for Django
<p>I am running a Django site on DigitalOcean using 1ClickInstallation image. Every thing worked fine but I got issue for 504 Gateway Timeout Error. I've tried multiple settings on blogs but not working. Following are my settings:</p>

<pre><code>upstream app_server {
    server 127.0.0.1:9000 fail_timeout=0;

}


server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /home/django/django_project;
    index index.html index.htm;

    client_max_body_size 4G;
    server_name www.mydomain.com;


    keepalive_timeout 5;

    location ~*  \.(jpg|jpeg|png|gif|ico|css|js|woff2|woff|ttf)$ {
        expires 365d;
    }



    # Your Django project's media files - amend as required
    location /media  {
        alias /home/django/django_project/media/;
    }

    # your Django project's static files - amend as required
    location static/static-only {
        alias /home/django/django_project/static-only/; 
    }
    # Django static images
    location /static/django_project/images {
        alias /home/django/django_project/static-only/django_project/images/;
    }


    # Proxy the static assests for the Django Admin panel
    location /static/admin {
       alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://app_server;

    }
}
</code></pre>

<p>I followed docs at following link <a href="http://nginx.org/en/docs/http/ngx_http_limit_req_module.html" rel="noreferrer">http://nginx.org/en/docs/http/ngx_http_limit_req_module.html</a></p>

<p>Following is the result of "wget 127.0.0.1:9000"</p>

<p><a href="https://i.stack.imgur.com/YYu94.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/YYu94.jpg" alt="enter image description here"></a></p>

<p>but couldn't make sense that where exactly to add directives. Kindly advise. </p>