multiple listen directives

Maxim Dounin mdounin at mdounin.ru
Mon Sep 16 13:45:43 UTC 2013


Hello!

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

> Hi Igor,
> 
> Am 16.09.2013 14:17, schrieb Igor Sysoev:
> >>
> >>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
> >>
> >
> >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?

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



More information about the nginx mailing list