Last Updated on 3 months by Sachin G

Find apache  or  httpd  configuration file path 

Most of the user not known to find or path of web server configuration file of Apache ( httpd )  in server.Apache having different configuration path on different OS , It depend on installation of apache by which method is used .

Run below commands to find the path of Apache configuration file .

For CentOs , RHEL  or Linux based system

Get the apache process through ps command.

# ps -ef | grep apache

root 9317 9030 0 12:47 pts/0 00:00:00 grep –color=auto apache
apache 29870 942 0 09:12 ? 00:01:16 /usr/sbin/httpd -DFOREGROUND
apache 29911 942 0 09:12 ? 00:01:14 /usr/sbin/httpd -DFOREGROUND
apache 29920 942 0 09:12 ? 00:01:18 /usr/sbin/httpd -DFOREGROUND
apache 32156 942 0 01:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 32158 942 1 01:25 ? 00:08:43 /usr/sbin/httpd -DFOREGROUND
apache 32169 942 1 01:25 ? 00:08:44 /usr/sbin/httpd -DFOREGROUND

Get the path from process  and run the below command.

#/usr/sbin/httpd -V | grep HTTPD_ROOT

Output :

[Sun Apr 05 12:49:36.333807 2020] [so:warn] [pid 9394] AH01574: module ruid2_module is already loaded, skipping
-D HTTPD_ROOT=”/etc/httpd”

#/usr/sbin/httpd -V | grep SERVER_CONFIG_FILE

OUTPUT :

[Sun Apr 05 12:51:45.718351 2020] [so:warn] [pid 9654] AH01574: module ruid2_module is already loaded, skipping
-D SERVER_CONFIG_FILE=”conf/httpd.conf”

Now from above two command output from HTTP_ROOT the main directory of apache is “/etc/httpd and configuration file is located under /etc/httpd , i.e “conf/httpd.conf” and full path will be “/etc/httpd/conf/httpd.conf

For Ubuntu or Debian Based System

# ps -ef | grep apache
# /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE

P.S : The most common command for check apache information from below command.

httpd –V ( for centos , rhel or linux based)

# apache2ctl –V ( for ubuntu or debian based system)