Finding Apache configuration file (httpd.conf) location Jun 08, 2011
Just a quick tip for programmers working with Apache. Sometimes I’m asked where to find the Apache configuration file on a given server. Since it’s possible to configure this there is no “default location” so I usually do:
$ ps -ef | grep apache
which gives me a list like
deploy@cmd01:/$ ps -ef | grep apache
root 4053 1 0 06:26 ? 00:00:04 /usr/sbin/apache2 -k start
www 5189 4053 0 11:00 ? 00:00:00 /usr/sbin/apache2 -k start
www 5199 4053 0 11:00 ? 00:00:00 /usr/sbin/apache2 -k start
...
Then simply run
$ /usr/sbin/apache2 -V
and you will get the details you need, specifically this
Server compiled with....
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
That’s it. Are you using another/faster approach? Let me know.