# Nginx as loadbalancer for tomcat with session stickyness bases on jvmRoute

**URL:** <https://www.ruby-forum.com/t/nginx-as-loadbalancer-for-tomcat-with-session-stickyness-bases-on-jvmroute/235819>\
**Category:** NGINX\
**Created:** [July 17, 2013, 5:40pm UTC](https://www.ruby-forum.com/t/nginx-as-loadbalancer-for-tomcat-with-session-stickyness-bases-on-jvmroute/235819 "2013-07-17T17:40:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [July 17, 2013, 5:40pm UTC](https://www.ruby-forum.com/t/nginx-as-loadbalancer-for-tomcat-with-session-stickyness-bases-on-jvmroute/235819/1 "2013-07-17T17:40:42Z")

</div>

Hello everyone,  
I’m currently using apache mod\_jk to load balance over four backend  
tomcat servers. The sessions are not replicated so I need stickyness  
based on jvmRoute. The mod\_jk configuration is:

worker.list=router, jkstatus

worker.router.type=lb  
worker.router.balance\_workers=tomcat-01, tomcat-02, tomcat-03, tomcat-04

worker.tomcat-01.type=ajp13  
worker.tomcat-01.host=tomcat-01  
worker.tomcat-01.port=8009  
worker.tomcat-01.lbfactor=1

worker.tomcat-02.type=ajp13  
worker.tomcat-02.host=tomcat-02  
worker.tomcat-02.port=8009  
worker.tomcat-02.lbfactor=1

…

worker.jkstatus.type=status

I would like to replace apache with nginx. What ways exist to do that  
and what are the pros and cons? I use Debian Wheezy and would like to  
stick if possible with the packaged nginx.

What about tomcat maintenance? I would like the ability gracefully  
reroute  
traffic (taking a tomcat in maintance let still existing sessions to get  
through but not route any new connections to a particular tomcat).

Cheers,  
Thomas
