Welcome! Log In Create A New Profile

Advanced

My Load Balancing configure is fail.

March 18, 2010 10:12PM
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".
Subject Author Posted

My Load Balancing configure is fail.

ultrawind March 18, 2010 10:12PM

Re: My Load Balancing configure is fail.

Yu Sun March 19, 2010 11:22PM

Re: My Load Balancing configure is fail.

ultrawind March 21, 2010 11:39PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 53
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready