how to configure multiple virtual server on nginx?

debugger87 nginx-forum at nginx.us
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  
> TOMCAT.DOMAIN.NAME;
>         }
> 
> Since by default nginx sends "Host: my_upstream".
> 
> 
> -- 
> Igor Sysoev
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Thanks,Igor.
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
following.
IP-1:80 <=====> 1st server  IP-1:8080 <=========>tomcat      both work
right
IP-2:80 <=====> 2nd server  IP-2:8080 <=========>tomcat      both work
right
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
right
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
right
 
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
problem.
It's pleasure to wait for your reply.
Thanks!

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



More information about the nginx mailing list