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

i'm having some problems with nginx. I think it's easy to solve, but i'm extremely newbie in nginx, so:

When worker_connections reach limit, nginx return a 500 internal server error. I want to customize this page, but error_page doesn't work =/

On error log:

[alert] 32194#0: *10 4 worker_connections are not enough while connecting
to upstream, client: X.X.X.X, server: example.com, request: "GET / HTTP/1.1",
upstream: "fastcgi://127.0.0.1:9000", host: "example.com"

and my nginx.conf:

worker_processes  4;

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

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
        proxy_intercept_errors on;
        proxy_next_upstream error timeout http_500 http_503;

    sendfile        on;
    keepalive_timeout  65;

    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_min_length  1100;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/gif image/jpeg image/png;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_vary on;

    server {
        root /var/www/default/public/;
        server_name example.com;
        listen X.X.X.X:80 default;
        server_name_in_redirect off;
        server_tokens off;
        log_not_found off;

        error_page 404 /index?$uri;
            error_page 403 /restricted;
            error_page 401 /restricted;
                error_page 500 /50x.html;

                location = /50x.html {
                        root /var/www/default/public/;
                }

        gzip on;
        gzip_types text/css application/x-javascript text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

        location / {        
            error_page 404 /index?$uri;
            charset utf-8;
            if_modified_since off;

            add_header X-UA-Compatible "IE=Edge,chrome=1";
            add_header X-Powered-By "";
            add_header ETag "";

            index index.php index.html index.htm;
        }


        location ~ \.php$ {
            include fastcgi_params; 
            fastcgi_index index.php; 
            fastcgi_param SCRIPT_FILENAME /var/www/default/public$fastcgi_script_name; 
            fastcgi_param SERVER_NAME $http_host;
            fastcgi_ignore_client_abort on;
            fastcgi_pass 127.0.0.1:9000; 
            fastcgi_intercept_errors on;
            error_page 404 /404;
        }

    }
}
share|improve this question

1 Answer 1

Try creating an error_page at the http section and see if that triggers. I guess hitting worker limit means server sections won't be parsed at all.

share|improve this answer
    
it won't work, but i recompiled my nginx with an edited 500 error page . thank you –  Rodrigo Oct 26 '11 at 18:04

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.