Why no top-level set?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Wed Apr 30 14:06:44 MSD 2008

For some reason, the set directive is available only within server
block. Wouldn't it be possible to handle set's also on the top level?

Motivation? Well, some use case:

  set logdir /my/log/dir;
  error_log $log_dir/error.log

  # ...
  http {
  # ...
     server {
         access_log $log_dir/access.log combined;

Similarly one could set crucial ports, hostnames etc once and reuse them
thorough the file.

Another possibility - one could write whole server config using
variables for directories, ports etc, then include it into files which
would just set those variables differently (and - say - reuse the same
config on different machines).

| Marcin Kasperski   | People resist change, regardless of what
| http://mekk.waw.pl |           it is. (Michael Reed)
|                    |

More information about the nginx mailing list