总体思路:本机安装Nginx,分发到192.168.0.10、192.168.0.11两台Tomcat服务器,192.168.0.12安装Memcached,两台Tomcat服务器通过Memcached共享Session。(当然全部部署到同一台电脑也可以,配置好端口就行)
一、Nginx1.6
1.配置conf/nginx.conf:
(1)http {}中添加:
upstream 127.0.0.1{
server 192.168.0.10:8080;
server 192.168.0.11:8080;
}
(2)location / {}中添加:
proxy_pass http://127.0.0.1;
二、Tomcat6,分别在2台电脑(192.168.0.10、192.168.0.11)中安装好Tomcat,
1.conf/server.xml,端口设置为8080
2.conf/server.xml的<Host></Host>中添加:
<Context reloadable="false" path="" >
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.0.12:11211"
sticky="false"
sessionBackupAsync="false"
lockingMode="auto"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.JavaSerializationTranscoderFactory"
/>
</Context>
3.到https://code.google.com/p/memcached-session-manager/downloads/list下载jar包,放到lib下
三、启动
Window下Nginx1.6+Tomcat6+Memcached精简配置,布布扣,bubuko.com