location "default" documentation

James Byers jbyers at gmail.com
Wed Jan 14 08:40:10 MSK 2009


I had some trouble setting the "deferred" option on a listen
directive, related to the use of  "default".  If someone can help me
understand this better, I'll update the English documentation.

Our configuration has many server blocks, which look like the example
below.  My first attempt was to append "deferred" to all of the listen
lines.  This resulted in the error: '"deferred" parameter can be
specified for the default "listen" directive only'.  My second attempt
was to put "deferred" only on the first entry in each server block,
thinking it was the implicit default.  Same error.  When explicitly
specifying the default, as in "listen 1.2.3.4:80 default deferred;" in
each server block, all's well.

Two questions:

1. Is this setting "deferred" for all of the listen directives in the
server block?  If not, how can this be done?
2. What does "default" actually do?  The docs for listen say:

'If the directive has the "default" parameter, then the enclosing
server {...} block will be the default server for the address:port
pair. If there are no directives with the "default" parameter, then
the default server will be the first server in which the address:port
pair appears.'

This suggests multiple server blocks can have the same address:port,
with one server block being the default. I can imagine a use for the
with wildcard addresses, but not with explicit addresses.  And I'm
left wondering how to set all sockets to deferred.

Thanks,
James

server {
 listen 1.2.3.4:80;
 listen 5.6.7.8:80;
 ...
}
server {
 listen 1.2.3.4:443;
 listen 5.6.7.8:443;
 ...
}





More information about the nginx mailing list