0

I'm using Nginx + Gunicorn which is serving my Django project. All GET requests hang for ~1 min. The content seems to be available immediately as I can see it in the Browser inspector but the browser itself looks like it's still waiting for more data. Heres my Ngnix config

#allow for up to 3 connections per second.
limit_req_zone  $binary_remote_addr  zone=one:10m   rate=3r/s; 

server {
listen   80;
server_name example.com;

root /var/www/example.com/example/;

# serve directly - analogous for static/staticfiles
location /media/ {
    # this changes depending on your python version
    root /home/example/;
}
location /static/ {
    # if asset versioning is used
    if ($query_string) {
        expires max;
    }
    root /var/www/example.com;
}


location / {

    #Allow for a burst of 50.
    limit_req   zone=one burst=50 nodelay;
    proxy_pass_header Server;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_connect_timeout 10;
    proxy_read_timeout 10;
    proxy_pass http://localhost:8001/;
}


# what to serve if upstream is not available or crashes
error_page 500 502 503 504 /media/50x.html;
}

My Gunicorn Config:

bind = "127.0.0.1:8001"
workers = 3
worker_class = "gevent"

Is there anything obvious that would be causing the requests to stay open for so long?

quanta
  • 51,413
  • 19
  • 159
  • 217
whatWhat
  • 529
  • 2
  • 5
  • 9

1 Answers1

0

Turns out the issue was my route to my static content was incorrect, causing it to block on each request.

whatWhat
  • 529
  • 2
  • 5
  • 9