Load balancing
Johnson Chen
lists at ruby-forum.com
Fri May 15 10:12:50 MSD 2009
HI
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 server1.com;
server server2.com;
}
server {
listen 80;
server_name www.mainserver.com mainserver.com;
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_add_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 mainserver.com,
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...
Johnson.
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list