Forum: NGINX multiple listen directives

28802c1455ba9b8b14838c2934410448?d=identicon&s=25 Axel (Guest)
on 2013-09-16 14:12
(Received via mailing list)
Hi all,

I want to build an active/active cluster and therefore configure nginx
to listen on multiple IP adresses.

I read http://nginx.org/en/doc/http/ngx_http_core_module....
but found no information if I can use multiple listen directives for ssl
without activating the interface.

Can I configure it like this? And are there any problems I will need to
think of?

Server A: 192.168.178.20
Server B: 192.168.178.30
Server C: 192.168.178.40


server {
    listen                     192.168.178.20:443 ssl;
    listen                     192.168.178.30:443 ssl;
    listen                     192.168.178.40:443 ssl;
    server_name                my.example.com;
...
...
}

Regards, Axel
0f7a1240e82f744c6c607fa7081b99f7?d=identicon&s=25 Igor Sysoev (Guest)
on 2013-09-16 14:17
(Received via mailing list)
On Sep 16, 2013, at 16:11 , Axel wrote:

> Server B: 192.168.178.30
> }
>
> Regards, Axel
>

Add wildcard:

  listen                     *:443 ssl;
  listen                     192.168.178.20:443 ssl;
  listen                     192.168.178.30:443 ssl;
  listen                     192.168.178.40:443 ssl;


--
Igor Sysoev
http://nginx.com
28802c1455ba9b8b14838c2934410448?d=identicon&s=25 Axel (Guest)
on 2013-09-16 15:15
(Received via mailing list)
Hi Igor,

Am 16.09.2013 14:17, schrieb Igor Sysoev:
>> Regards, Axel
>>
>
> Add wildcard:
>
>   listen                     *:443 ssl;
>   listen                     192.168.178.20:443 ssl;
>   listen                     192.168.178.30:443 ssl;
>   listen                     192.168.178.40:443 ssl;

thanks for your reply.

What happens when i add a wildcard this way? I found
http://trac.nginx.org/nginx/ticket/187
As far as I understand this wildcard enables nginx to bind on one of the
given interfaces? Or is this a "catch-all" for the server block?

Do I need to add this wildcard to any enabled vHost?

Regards, Axel
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-09-16 15:46
(Received via mailing list)
Hello!

On Mon, Sep 16, 2013 at 03:14:41PM +0200, Axel wrote:

> >>...
> >  listen                     192.168.178.40:443 ssl;
>
> thanks for your reply.
>
> What happens when i add a wildcard this way? I found
> http://trac.nginx.org/nginx/ticket/187
> As far as I understand this wildcard enables nginx to bind on one of
> the given interfaces? Or is this a "catch-all" for the server block?

If a wildcard listen on a port is used anywhere in configuration,
nginx will listen on a wildcard address and won't try to bind to
individual addresses.  In particular, this allows to configure
listen directives with addresses not currently present on a host.

Some details can be found at http://nginx.org/r/listen, see "bind"
parameter description.

> Do I need to add this wildcard to any enabled vHost?

No, you don't.  It's enough to add it anywhere in the
configuration.

--
Maxim Dounin
http://nginx.org/en/donation.html
28802c1455ba9b8b14838c2934410448?d=identicon&s=25 Axel (Guest)
on 2013-09-16 20:39
(Received via mailing list)
Thanks. This helps a lot.

Regards, Axel


Am 16.09.2013 15:45, schrieb Maxim Dounin:
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.