3

Static page is served correctly you can visit : http://www.ec2.lankenow.info/ click on the image and it will take you to the error page.

Nginx error log:

2012/03/16 01:58:41 [alert] 884#0: 768 worker_connections are not enough  

2012/03/16 01:58:41 [error] 887#0: *3900 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 23.21.141.105, server: www.ec2.lankenow.info, request: "GET /leads HTTP/1.0", upstream: "http://23.21.141.105:80/leads", host: "www.ec2.lankenow.info", referrer: "http://www.ec2.lankenow.info/"

I think I might have to set client_header_buffer_size but dont know how or which file to edit. Any direction how to go about it would be much appreciated.

EDIT: This can be added to the http section of nginx.conf which can be found in /etc/nginx/ or usr/local/nginx/ depending on your installation

Config file under /etc/nginx/sites-available/

upstream vdiamond {
    server 0.0.0.0:3000;
    server 0.0.0.0:3001;
    server 0.0.0.0:3002;        
}


server {
    listen   80;
    server_name www.ec2.lankenow.info;

    access_log /home/ubuntu/vdiamond/log/access.log;
    error_log /home/ubuntu/vdiamond/log/error.log;

    root   /home/ubuntu/vdiamond/public/;
    index  index.html;

    location / {

        # Add expires header for static content
        location ~* \.(js|css|jpg|jpeg|gif|png)$ {
            if (-f $request_filename) {
                expires      max;
                break;
            }
        }

        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_read_timeout 300;
        proxy_next_upstream off;

        #proxy_redirect false;

        if (-f $request_filename/index.html) {
            rewrite (.*) $1/index.html break;
        }

        if (-f $request_filename.html) {
            rewrite (.*) $1.html break;
        }

        if (!-f $request_filename) {
            proxy_pass http://www.ec2.lankenow.info;
            break;
        }
    }
}
Brad Koch
  • 19,267
  • 19
  • 110
  • 137
sunny31
  • 91
  • 1
  • 9
  • 1
    I'm going to guess that the `worker_connections` is more likely the issue -- or, rather, the symptom -- why so many workers? Are there mistakes in your application that keep workers from being reaped or that too-easily spawns new workers? – sarnold Mar 16 '12 at 02:27
  • Sorry, its not my app but managing someone else app code. I am just trying to set up test server so eventually I can fix the app. – sunny31 Mar 16 '12 at 02:29
  • Have you tried increasing worker_connections and workers? – Gareth Davies Mar 17 '12 at 09:53
  • try changing the configuration proxy_buffer_size -> http://wiki.nginx.org/HttpProxyModule#proxy_buffer_size or large_client_header_buffers -> http://wiki.nginx.org/HttpCoreModule#large_client_header_buffers – Cícero Verneck Corrêa Jul 11 '13 at 16:27
  • @sunny31 If you solved your problem, you should move the solution to an answer. It makes it easier for future visitors with the same problem to understand what happened here. – Brad Koch Oct 10 '13 at 00:23
  • Possibly related: [400 bad request request header or cookie too large nginx Rails app](http://stackoverflow.com/q/17524396/425313) – Brad Koch Oct 10 '13 at 00:49

0 Answers0