Forum: NGINX Load balancing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8226fac14dd1cfee4d2402b1264d8577?d=identicon&s=25 Johnson Chen (johnsonchen)
on 2009-05-15 08:12

I am new to NGINX and I was trying to use NGINX as load balancer, but
somehow it didn't work. here is my configuration.

worker_processes  1;

error_log  /var/log/nginx/error.log info;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local]
"$request" '
    '"$status" $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;

    keepalive_timeout  65;

upstream mysvr   {

    server {
        listen       80;
        charset utf-8;

        access_log /var/log/nginx/localhost.log;
       error_log /var/log/nginx/error.log debug;

 location / {
                proxy_max_temp_file_size 0;

                client_max_body_size       10m;
                client_body_buffer_size    128k;

                proxy_connect_timeout      90;
                proxy_send_timeout         90;
                proxy_read_timeout         90;

                proxy_buffer_size          4k;
                proxy_buffers              4 32k;
                proxy_busy_buffers_size    64k;
                proxy_temp_file_write_size 64k;

            root   html;
            index  index.html index.htm;

            proxy_pass      http://mysvr;

            proxy_set_header  X-Forwarded-For
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header  Host $http_host;
            proxy_set_header  Host  $host;


This is just a simple load balancing. When i request the,
the page didn't even show up.  When i checked the log, it said "[alert]
13442#0: *1013 socket() failed (24: Too many open files) while
connecting to upstream". If i comment the "proxy_pass" line, it will
work, any help is appreciated.

Thank You...

This topic is locked and can not be replied to.