I've always struggled to find this: How can you ask apache which httpd.conf file it used to load up?
It becomes difficult when you have a number of instances of apache running, or if you haven't looked at the machine for a long time, and there are a lot of httpd.conf file on disk!
Thanks a lot :)
/usr/sbin/apache2 -V
provides this info and a little more :)As of 2016 (Bug 59376), from
Apache 2.4.23
onwards, an option dedicated to this purpose is available.It can display the entire config file tree, including line numbers, which is useful to debug complex configurations.
Or,
In Yosemite I found it was
/Library/Server/Web/Config/apache2/httpd_server_app.conf
Even though
apachectl -V | grep .conf
Gives
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
For RHEL or Centos, first find the running Apache process...
Note the path in the output. For me, it is...
You can then use the -V option with this path to get the configuration path...
Amongst the output you should see an absolute path for HTTPD_ROOT and also a relative path for the SERVER_CONFIG_FILE. Put that absolute path and relative path together and you have your configuration file location.
Credit: https://stackoverflow.com/a/22900993/861826