Nginx + Tomcat7 for single webapp and multiple alias domain

cfsego nginx-forum at nginx.us
Thu Sep 15 03:46:53 UTC 2011


Yes, It is good for you to NGINX in front of your application server,
for that you will gain extra features, ie. load-control and DoS
tolerance for your stability.

And it is simple for you to configure NGINX to use tomcat as backend.
When your tomcat listens localhost:8080, the nginx configuration may be
like this:

>>> location / {
>>>     proxy_pass 127.0.0.1:8080;
>>>     proxy_set_header        Host $host;
>>>     proxy_set_header        X-Real-IP $remote_addr;
>>>     proxy_set_header        X-Forwarded-For
$proxy_add_x_forwarded_for;
>>> }

so you will get the clients' real IP from the HTTP header "X-Real-IP"

hope this helps

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,215189,215225#msg-215225



More information about the nginx mailing list