负载均衡简单的成功案例。

2014年5月30日 由 admin 留言 »
user  www www;
worker_processes 1;
#最大文件描述符
worker_rlimit_nofile 65535;
 
events 
{
      use epoll;
      worker_connections 65535;
}
 
http 
{
      include       mime.types;
      default_type  application/octet-stream;
      keepalive_timeout 120;
      tcp_nodelay on;
 
      upstream  www.test.com  {
              server   1xx.2xx.xx.252:80;
              server   2xx.1xx.xx.253:80;
              ip_hash;
      }
 
     log_format  www_test_com  '$remote_addr - $remote_user [$time_local] $request '
                                '"$status" $body_bytes_sent "$http_referer" '
                                '"$http_user_agent" "$http_x_forwarded_for"';
      access_log  logs/test.log  www_test_com;
 
      server
      {
              listen  80;
              server_name  www.test.com;
 
    location / {
             proxy_pass        http://www.test.com;
             proxy_set_header   Host             $host;
             proxy_set_header   X-Real-IP        $remote_addr;
             proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
              }
 
      }
 
}
广告位 
分享到:

发表评论