how to configure multiple virtual server on nginx?

Igor Sysoev igor at
Wed Jul 27 09:02:52 UTC 2011

On Wed, Jul 27, 2011 at 04:58:14AM -0400, debugger87 wrote:
> Thank you,Maxim Dounin.
> I also think that the problem is outside of nginx.But I'm confused why
> IP-1 and IP-2 work,IP-3 don't.
> On my computer,IP-1:8080,IP-2:8080,IP-3:8080 and IP-4:8080 are LISTENED
> by tomcat application server.
> I can access my tomcat by the whole IP address.It looks like a
> contradiction that I can access tomcat via IP-3:8080,
> and I can not access nginx via IP-3:80.It's very terrible!

Probably you need to add tomcat server name in Host header:

        location / {
                proxy_pass http://my_upstream;
                proxy_set_header   Host   TOMCAT.DOMAIN.NAME;

Since by default nginx sends "Host: my_upstream".

Igor Sysoev

More information about the nginx mailing list