Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.