Find the Location of httpd.conf, the Apache Configuration File

We, all the webmasters, sometimes need to make changes to the httpd.conf file in order to tweak Apache web server’s configuration. httpd.conf is the main file that holds entire configuration for Apache web server. But this file may be located in different locations depending upon the OS and user’s preferences (that is to say that the location of this file itself is configurable). Therefore, there is no preset exact location where you can find the file.

So, how to find the location of httpd.conf?

Well, the best answer is to ask Apache!… and this is how we do it:

(This method will work only when Apache is running)

1) Use the ps command to show list of processes that are currently running and then pipe the output through grep command to filter only running Apache processes

$ ps -ef | grep apache

This command may show you several apache processes, like:

00:00:02 /usr/local/apache/bin/httpd -k start –DSSL

The above output tells us where the Apache demon is located. Now run the following command to get the configuration settings of httpd:

$ /usr/local/apache/bin/httpd –V

Make sure that you use capital V to get detailed version information. The output will tell you the location of your httpd.conf file. Output will have a line similar to:

-D SERVER_CONFIG_FILE=”conf/httpd.conf”

And that is it! You have the address of the house of Apache configuration file.

I hope it was useful for you. Please feel free to ask if you have any questions on this topic. I will be happy to try and help you. Thank you for using TechWelkin.

Leave a Comment

Your email address will not be published. Required fields are marked *