how to configure multiple virtual server on nginx?

debugger87 nginx-forum at
Wed Jul 27 10:03:59 UTC 2011

Igor Sysoev Wrote:
> 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  
>         }
> Since by default nginx sends "Host: my_upstream".
> -- 
> Igor Sysoev
> _______________________________________________
> nginx mailing list
> nginx at

I have changed the configuration file nginx.conf as what you say.
Things go athwart,the 3rd server doesn't work as before.
To describe my problem more definetely,I will give more information as
IP-1:80 <=====> 1st server  IP-1:8080 <=========>tomcat      both work
IP-2:80 <=====> 2nd server  IP-2:8080 <=========>tomcat      both work
IP-3:80 <=====> 3rd server  IP-3:8080 <=========>tomcat      I can
access tomcat by IP-3:8080,but can not access nginx by IP-3:80.

Then,I try another configuration
IP-1:80 <=====> 1st server  IP-1:8080 <=========>tomcat      both work
IP-3:80 <=====> 2nd server  IP-2:8080 <=========>tomcat      I can
access tomcat by IP-2:8080,but can not access nginx by IP-3:80.
IP-2:80 <=====> 3rd server  IP-3:8080 <=========>tomcat      both work
In my eyes,my nginx configuration is correct.But the IP address IP-3
looks like very special.It can work for tomcat,but nginx not.
Have you ever met that strange problem?I'm struglling to sovle that
It's pleasure to wait for your reply.

Posted at Nginx Forum:,212966,212992#msg-212992

More information about the nginx mailing list