Mikhail Mazursky
September 15, 2011 05:32AM
2011/9/14 tm1978 <nginx-forum@nginx.us>:
> I am thinking about using NGINX instead of Apache to deliver a Tomcat7
> webapp on Port :80 to the enduser.
>
> I have the following requirements:
>
> 1. There is a single  web-app in the root with any urls (its own
> internal urlrewriting). It has various URLs pointing to it for several
> languages (and partially other content)
>
> 2. Another admin-webapp exists
>
>
> My questions are:
>
> (a) would it be a good idea to use NGINX a without  Apache Http server,
> just with Apache Tomcat7 ?
> (b) how can I set this up so that the Tomcat App always know the domain
> name the user was using when calling the page?
> (c) will the tomcat app still be able to know the IPs of every user?

For this you will have to setup a RemoveIpValve [1] in your
context.xml/server.xml/context.xml.default like this:

<Valve
className="org.apache.catalina.valves.RemoteIpValve"
remoteIpHeader="X-Forwarded-For"
protocolHeader="X-Forwarded-Proto" />

In nginx you may use configuration provided by cfsego but don't forget
to add X-Forwarded-Proto if you use https on nginx. Also you may
remove X-Real-IP header because it's not used in this setup:

>>> location / {
>>> proxy_pass 127.0.0.1:8080;
>>> proxy_set_header Host $host;
>>> proxy_set_header $remote_addr;

proxy_set_header X-Forwarded-Proto $scheme;

>>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>> }


This way Tomcat will be aware of https and will use secure cookies for sessions.

[1]: https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Remote_IP_Valve

> Thanks!
>
> Tobias

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx + Tomcat7 for single webapp and multiple alias domain

tm1978 September 14, 2011 07:26AM

Re: Nginx + Tomcat7 for single webapp and multiple alias domain

cfsego September 14, 2011 11:46PM

Re: Nginx + Tomcat7 for single webapp and multiple alias domain

Mikhail Mazursky September 15, 2011 05:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 272
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready