Is it possible to get which conf the nginx is using only from a running nginx process?
To get the conf file path. sometimes ps aux
reveal it, sometimes it doesn't. It might be just something like nginx: master process /usr/sbin/nginx
(same as /proc/PID/cmdline
)
- So is
nginx -V
the only solution? - From this question, is it possible to dump conf data structure from nginx process directly? Or at least dump the conf file path?
As of Nginx 1.9.2 you can dump the Nginx config with the
-T
flag:Source: http://nginx.org/en/docs/switches.html
This is not the same as dumping for a specific process. If your Nginx is using a different config file, check the output for
ps aux
and use whatever it gives as the binary, e.g. if it gives something likeyou need to run
If you are not on 1.9.2 yet, you can dump the config with gdb: