My Load Balancing configure is fail.

ultrawind nginx-forum at nginx.us
Fri Mar 19 05:12:34 MSK 2010


I config load balancing in my main server. 
But after I config it,it alway visit server 192.168.1.140, and display "140".
Why it do not go to http://192.168.1.124 in 50%?

My main server 192.168.1.124 nginx.conf file:

user  daemon;
worker_processes  2;

error_log  logs/error.log  info;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;
    sendfile        on;

    keepalive_timeout  65;
    #gzip  on;
    client_max_body_size 40m;
    
    upstream myproject {
        server 192.168.1.140:80 weight=5;
        server 192.168.1.124:80 weight=5;
    }
    server {
        listen       80;
        server_name  192.168.1.124;

        location / {
            proxy_pass http://myproject;
            root   /home/httpd/html;
            index  index.html index.htm index.php;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /home/httpd/html/$fastcgi_script_name;
            include        fastcgi_params;
        }
        location /NginxStatus/ {
             auth_basic              "NginxStatus";
             auth_basic_user_file conf/htpasswd;
             access_log off;
        }
    }

}

and visit http://192.168.1.124 display "124".

My second server 192.168.1.140 nginx.conf file:

#user  nobody;
worker_processes  2;

error_log  /var/log/nginxerror.log  info;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;
    sendfile        on;
    keepalive_timeout  65;
    #gzip  on;

    server {
        listen       80;
        server_name  192.168.1.140;
        location / {
            root   /home/httpd;
            index  index.html index.htm index.php;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /home/httpd/$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
}
and visit http://192.168.1.140 display "140".

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




More information about the nginx mailing list