Where Is The Apache Configuration File In CentOS?

How can we find where the default configuration files for the httpd package in CentOS are located?

By using the RPM command we can query a package to find all of its associated configuration files. Failing that we can use the find command to search the file system for these files, as we will see here.

RPM Query Configuration Files

The options we will use with the RPM command are -q to query a package, and -c which will list the configuration files that are part of the package. As shown below we have run RPM with the -qc options on the httpd package, which is where Apache comes from in CentOS.

[[email protected] ~]# rpm -qc httpd

These are all of the default configuration files that are installed by the httpd package.

The primary Apache configuration file is /etc/httpd/conf/httpd.conf, most of the changes to Apache will be made here.

Find Command

If you aren’t using packages to install Apache and perhaps compiled it from source instead or otherwise installed to a custom location, we can easily run find over the entire file system to find these files.

[[email protected] ~]# find / -name httpd.conf

The above example will search through the root of the file system ‘/’ and find every file named ‘httpd.conf’.

Don’t forget that if you edit any of the Apache configuration files you will need to reload or restart Apache to apply the changes.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>