Multiple listen directives

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.html#listen
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

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 S.
http://nginx.com

Hi Igor,

Am 16.09.2013 14:17, schrieb Igor S.:

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

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 D.
http://nginx.org/en/donation.html

Thanks. This helps a lot.

Regards, Axel

Am 16.09.2013 15:45, schrieb Maxim D.:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs