1.下载安装jvm_route:http ://nginx-upstream-jvm-route.googlecode.com/svn/trunk/nginx-upstream-jvm-route-read-only cd /usr/src/nginx-1.2.1 patch - p0 < /usr/local/nginx/nginx_upstream-jvm-route-read-only/jvm_route.patch ./configure --add-module=/usr/local/nginx/nginx-upstream-jvm-route-read-only make & make install 2.nginx 设置: 修复 upstream www.linuxidc.com { server 192.168.1.116:8080 srun_id=a; 这里 srun_id=a 对应的是 server1 resin 配置里的 server id="a" server 192.168.1.117:8081 srun_id=b; 这里 srun_id=b 对应的是 server2 resin 配置里的 server id="b" jvm_route $cookie_JSESSIONID|sessionid; } 3.tomcat 设置: 192.168.0.116设置: 修改tomcat/conf/server.xml <Engine name="Catalina" defaultHost="localhost" jvmRoute="a"> 192.168.0.117设置: 修改tomcat/conf/server.xml <Engine name="Catalina" defaultHost="localhost" jvmRoute="b"> 3.配置完成 //安装patch命令 //yum -y install patch