Welcome! Log In Create A New Profile

Advanced

Re: Binding nginx to a single interface

Maxim Dounin
February 13, 2012 03:50PM
Hello!

On Mon, Feb 13, 2012 at 11:08:25AM -0500, Bai Shen wrote:

> But I'm not defining an ip server_name. Isn't nginx listening for
> server_names?
>
> Right now I have example.com rewriting to www.example.com They both listen
> on 10.1.2.3. Previously, I could connect to 10.1.2.3 and it would redirect
> me to the web server. Now when I connect to 10.1.2.3 it rewrites the url
> to www.example.com and because I'm internal, that never resolves. How do I
> set nginx to do the redirect without the rewrite?

Sorry, I wasn't able to understand your question. Though overal
you probably need to set server_name_in_redirect to off, see here:

http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name_in_redirect

And you probably want to re-read the article here:

http://nginx.org/en/docs/http/request_processing.html

Maxim Dounin

>
> On Thu, Feb 9, 2012 at 6:34 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> > Hello!
> >
> > On Thu, Feb 09, 2012 at 01:06:14PM -0500, Bai Shen wrote:
> >
> > > They do.
> > >
> > > However, I do have some weird behaviour. I have the server_name set to
> > > www.example.com and that correctly connects me to my web server. But
> > if I
> > > type in 10.1.2.3, that connects me to my web server as well, even though
> > I
> > > don't have a default rule setup.
> > >
> > > When I go to 10.1.2.4 I get a "Welcome to nginx!" page.
> >
> > When selecting server{} based on server_name nginx will look only
> > through server{} blocks which have the listen socket defined.
> >
> > That is, if you have
> >
> > server {
> > listen 80;
> > server_name default;
> > }
> >
> > server {
> > listen 10.1.2.3:80;
> > server_name example.com;
> > }
> >
> > nginx will never consider "default" server if connection comes to
> > 10.1.2.3:80. All requests to 10.1.2.3:80 will end up in
> > "example.com" server as it's the only server defined for the
> > listen socket in question.
> >
> > More details may be found here:
> >
> >
> > http://nginx.org/en/docs/http/request_processing.html#mixed_name_ip_based_servers
> >
> > and in docs.
> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >

> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

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

Binding nginx to a single interface

Bai Shen February 09, 2012 12:44PM

Re: Binding nginx to a single interface

Adrián Navarro February 09, 2012 12:46PM

Re: Binding nginx to a single interface

Bai Shen February 09, 2012 12:52PM

Re: Binding nginx to a single interface

Adrián Navarro February 09, 2012 12:52PM

Re: Binding nginx to a single interface

Bai Shen February 09, 2012 01:04PM

Re: Binding nginx to a single interface

Bai Shen February 09, 2012 01:14PM

Re: Binding nginx to a single interface

Maxim Dounin February 09, 2012 12:56PM

Re: Binding nginx to a single interface

Bai Shen February 09, 2012 01:08PM

Re: Binding nginx to a single interface

Maxim Dounin February 09, 2012 06:36PM

Re: Binding nginx to a single interface

Bai Shen February 13, 2012 11:10AM

Re: Binding nginx to a single interface

Maxim Dounin February 13, 2012 03:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 293
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