Find out if config file is loaded/used

Maxim Dounin mdounin at mdounin.ru
Tue Jun 2 12:29:01 UTC 2015


Hello!

On Tue, Jun 02, 2015 at 11:52:41AM +0200, Oliver Schrenk wrote:

> Hi,
> 
> we configured load balancing around 10 machines in 2 clusters 
> using symbolic links to various configuration file. We change 
> the symbolic link to a different file if we need to do 
> maintenance on one of the clusters and reload nginx. We are 
> building some automation around this and want to make sure that 
> a specific configuration is used. At the moment we just check 
> the path of the symbolic link but that doesn't necessarily mean 
> that the configuration is live.
> 
> Is there a way to query nginx which configuration (file) is 
> loaded?

The configuration file which is loaded is one you've asked nginx 
to load - either with "-c" argument, or by default.  It can be 
found from "ps" and/or "nginx -V" output, but it won't try to 
resolve symlinks and hence won't help in your case.

It's mostly trivial to configure nginx to return some 
configuration id though, like this:

    location = /configuration_id {
        return 200 some-configuration-id;
    }

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list