`

[Centos 6] 同一台机器部署多个Tomcat应用服务器

 
阅读更多

1. 修改/etc/profile文件

 

 

TOMCAT_HOME=/usr/share/tomcat6
CATALINA_BASE=/usr/share/tomcat6
CATALINA_HOME=/usr/share/tomcat6
export TOMCAT_HOME CATALINA_BASE CATALINA_HOME
TOMCAT_2_HOME=/usr/share/tomcat6_1
CATALINA_2_BASE=/usr/share/tomcat6_1
CATALINA_2_HOME=/usr/share/tomcat6_1
export TOMCAT_2_HOME CATALINA_2_BASE CATALINA_2_HOME

 

2. 修改tomcat2配置文件./bin/catanina.sh

 

export CATALINA_BASE=$CATALINA_2_BASE
export CATALINA_HOME=$CATALINA_2_HOME

 

    备注: tomcat1保持原来配置即可

 

3. 修改配置文件./conf/server.xml

 

    调整端口

8005--》8006

        8080--》8081

 

4. nginx 配置负载均衡

    修改配置文件 ./conf在http模块里面插入    

upstream tomcats {
         server localhost:8080 weight=5;
         server localhost:8081 weight=5;
    }
    

    server {
        listen       80;

        server_name www.example.com;
        location / {
            index  index.wml index.html index.htm index.jsp;

            proxy_pass http://tomcats;
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            client_max_body_size 50m;
            client_body_buffer_size 256k;
            proxy_connect_timeout 10;
            proxy_send_timeout 60;
            proxy_read_timeout 60;
            proxy_buffer_size 4k;
            proxy_buffers 4 32k;
            proxy_busy_buffers_size 64k;
            proxy_temp_file_write_size 64k;
        }
        

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics