High CPU when upstream server down

adamn nginx-forum at nginx.us
Tue Mar 8 23:35:05 MSK 2011


Using the same config file - everything works fine and this is not
reproducible on 0.8.54.  Here is my config.  Keep in mind that the
upstream and server section are in reality 8 upstreams and servers -
most of which are exactly the same with the exception of the server_name
and the unix socket filename.


user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log debug;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    upstream dev.example.com {
        server unix:/tmp/gunicorn_dev.example.com.sock;
        # For a TCP configuration:
        #server 127.0.0.1:8000;
    }
    server {
        listen 80;
        client_max_body_size 4G;
        server_name dev.example.com;

        keepalive_timeout 5;

        # path for static files
        root /var/www/dev-example-env/example/media;

        location = /favicon.ico {
            alias /var/www/dev-example-env/example/media/favicon.ico;
        }

        location = /robots.txt {

            alias /var/www/dev-example-env/example/media/no_robots.txt;

        }

        location /img {
            alias /var/www/dev-example-env/example/media/img/;
        }

        location /admin_media {
            alias
/var/www/dev-example-env/lib/python2.6/site-packages/django/contrib/admin/media/;
        }




        location / {

                auth_basic  "Restricted";
                auth_basic_user_file   
"/var/www/dev-example-env/example/.htpasswd";

            proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;

            if (!-f $request_filename) {
                proxy_pass http://dev.example.com;
                break;
            }
        }



        error_page 500 502 503 504 /500.html;
        location = /500.html {
            alias /var/www/dev-example-env/example/templates/500.html;
        }
    }
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,181397,181406#msg-181406




More information about the nginx mailing list