1.Nginx配置
/app/nginx/sbin/nginx-V
Tengineversion:Tengine/1.4.6(nginx/1.2.9)
builtbygcc4.4.720120313(RedHat4.4.7-3)(GCC)
TLSSNIsupportenabled
configurearguments:--user=nginx--group=app--prefix=/app/nginx--with-http_stub_status_module--with-http_ssl_module--with-http_concat_module--with-http_upstream_check_module--with-http_sub_module--with-http_realip_module
vim/app/nginx/conf/nginx.conf
upstreamapp_tomcat{
consistent_hash$remote_addr;
session_sticky;
server172.16.80.1:8000id=1001weight=1;
server172.16.80.2:8000id=1002weight=1;
checkinterval=1000rise=2fall=3timeout=1000type=httpport=8000;
check_http_send"GET/HTTP/1.0\r\n\r\n";
check_http_expect_alivehttp_2xxhttp_3xx;
}
vim/app/nginx/conf.d/app.test.com
server{
listen80;
server_nameapp.test.com;
#影藏.svn代码文件
location~^(.*)\/\.svn\/{
denyall;
}
location/{
concaton;
root/app/web/app.test.com/ROOT;
indexindex.htmlindex.htmindex.jsp;
}
location/status{
stub_statuson;
access_logoff;
allow172.16.80.0/24;
}
location~(\.jsp)|(\.do)|(/url/)|(/membercard/)|(\.action)${
session_sticky_hide_COOKIEupstream=app_tomcat;
proxy_passhttp://app_tomcat;
proxy_set_headerHostapp.test.com;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
}
error_page500502503504/50x.html;
location=/50x.html{
roothtml;
}
}
2.Tomcat配置
2.1第一台Tomcat
vim/app/tomcat/conf/server.xml
expireSessiOnsOnShutdown="false"notifyListenersOnReplication="true"/>
address="224.0.0.4"
port="45365"
frequency="500"
dropTime="3000"/>
address="172.16.80.1"
port="4002"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
主域名和二级域名之间的session复制
第二台Tomcat
vim/app/tomcat/conf/server.xml
expireSessiOnsOnShutdown="false"notifyListenersOnReplication="true"/>
address="224.0.0.4"
port="45365"
frequency="500"
dropTime="3000"/>
address="172.16.80.2"
port="4002"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
本文出自 “linux” 博客,请务必保留此出处http://zhangxinbeijing.blog.51cto.com/6969871/1314572