Both nginx -t and nginx -V will print the path to the default nginx configuration file.
$ nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful $ nginx -V nginx version: nginx/1.11.1 built by gcc 4.9.2 (Debian 4.9.2-10) built with OpenSSL 1.0.1k 8 Jan 2015 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf ...
If you want, you can get the configuration file:
$ nginx -V 2>&1 | grep -o '\-\-conf-path=\(.*conf\)' | cut -d '=' -f2 /etc/nginx/nginx.conf
Even if you downloaded some other configuration file, they will still print the default value.
ps aux will show you the currently loaded nginx configuration file.
$ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 11 0.0 0.2 31720 2212 ? Ss Jul23 0:00 nginx: master process nginx -c /app/nginx.conf
So that you can get the configuration file, for example:
$ ps aux | grep "[c]onf" | awk '{print $(NF)}' /app/nginx.conf
Jing Li Jul 24 '16 at 0:25 2016-07-24 00:25
source share