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).