I am tasked with converting (or attempting to convert) some legacy Apache virtual host configuration to Nginx, in Google Cloud (GCP). It is thought that Nginx might solve some performance issues. The ngnix (Debian11) VM will sit in front of (replacing the Apache in LB role) several Tomcat servers (Debian10) and perform reverse-proxy and load-balancer functions. In the legacy Apache LB configuration, the Tomcat servers are configured in a <Proxy balancer://tomcat>
stanza, as such:
BalancerMember ajp://10.10.184.4:8009 route=backend-server-1
... (additional tomcat servers)...
ProxySet stickysession=JSESSIONID
As I understand it, the open-source Nginx (I will not have access to Ngix Plus) does not have the same JSESSIONID options that Nginx Plus has:
https://docs.nginx.com/nginx/deployment-guides/load-balance-third-party/apache-tomcat/
So, with Nginx open-source, what is the best way I can attempt to mimic this Apache configuration, in my "upstream" block? My current MVP configuration looks like this:
(the Nginx documentation says that "ip hash" will result in session persistence, but this Apache configuration seems pretty reliant on the JSESSIONID)
upstream tomcat {
# Use IP Hash for session persistence
ip_hash;
# List of Tomcat application servers
server 10.10.184.2:8009;
server 10.10.184.3:8009;
server 10.10.184.4:8009;
}