码迷,mamicode.com
首页 > 其他好文 > 详细

nginx 虚拟主机+负载均衡

时间:2015-12-02 18:49:53      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:nginx 虚拟主机 负载均衡

worker_processes  2;

events {

    worker_connections  1024;

}

http {

    include       mime.types;

    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    #nginx vhosts config

  upstream rest_lc {

   #ip_hash; 

    server 192.168.1.240:8080 ;

    server 192.168.1.244:8080 ;

   #sticky name=srv_id expires=1h domain=www.lc.com path=/ ;

  }

  upstream wap_lc {

   #ip_hash;  

    server 192.168.1.240:8081 ;

    server 192.168.1.244:8081 ;

   #sticky name=srv_id expires=1h domain=www.lc.com path=/ ;

  }

  upstream activity_lc {

   #ip_hash;  

    server 192.168.1.244:8082 ;

    server 192.168.1.240:8082 ;

   #sticky name=srv_id expires=1h domain=www.lc.com path=/ ;

  }

    server{

    server_name rest.lc.in;

    listen  80;

    location / {

    root /home/tomcat/tomcat-rest;

    proxy_pass       http://rest_lc;

    proxy_set_header Host        $host;

    proxy_set_header X-Forwarded-For $remote_addr ;

    }

    }

    server{

        listen  80;

    server_name wap.lc.in;

    location / {

    root /home/tomcat/tomcat-wap;

    proxy_pass       http://wap_lc;

    proxy_set_header Host        $host;

    proxy_set_header X-Forwarded-For $remote_addr ;

    }

    }

    server{

    listen  80;

    server_name activity.lc.in;

    location / {

    root /home/tomcat/tomcat-activity;

    proxy_pass       http://activity_lc;

    proxy_set_header Host        $host;

    proxy_set_header X-Forwarded-For $remote_addr ;

    }


}

}


nginx 虚拟主机+负载均衡

标签:nginx 虚拟主机 负载均衡

原文地址:http://10896311.blog.51cto.com/10886311/1718870

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!