Apache Web Server Check Included Configuration Files Loaded via httpd.conf

There may be cases where you add one or more configuration files in your server root and try to load them by including them in the main server config file (apache2.conf or httpd.conf). What happens next is that you may not be sure if you actually see their effect on restarting the server. How can we avoid this ? Or if we just want to get a list of different config files that get included into our main server config in a specific order (loaded by the httpd server), is that possible ?

The apachectl program that ships freely with the Apache web server and acts as a frontend to the httpd server for administrative purposes can help us here. Let’s see how:

# apachectl -D DUMP_INCLUDES
Included configuration files:
  (*) /etc/apache2/apache2.conf
    (146) /etc/apache2/mods-enabled/access_compat.load
    (146) /etc/apache2/mods-enabled/alias.load
    (146) /etc/apache2/mods-enabled/auth_basic.load
    (146) /etc/apache2/mods-enabled/authn_core.load
    (146) /etc/apache2/mods-enabled/authn_file.load
    (146) /etc/apache2/mods-enabled/authz_core.load
    (146) /etc/apache2/mods-enabled/authz_host.load
    (146) /etc/apache2/mods-enabled/authz_user.load
    (146) /etc/apache2/mods-enabled/autoindex.load
    (146) /etc/apache2/mods-enabled/deflate.load
    (146) /etc/apache2/mods-enabled/dir.load
    (146) /etc/apache2/mods-enabled/env.load
    (146) /etc/apache2/mods-enabled/filter.load
    (146) /etc/apache2/mods-enabled/mime.load
    (146) /etc/apache2/mods-enabled/mpm_prefork.load
    (146) /etc/apache2/mods-enabled/negotiation.load
    (146) /etc/apache2/mods-enabled/php7.2.load
    (146) /etc/apache2/mods-enabled/reqtimeout.load
    (146) /etc/apache2/mods-enabled/rewrite.load
    (146) /etc/apache2/mods-enabled/setenvif.load
    (146) /etc/apache2/mods-enabled/status.load
    (147) /etc/apache2/mods-enabled/alias.conf
    (147) /etc/apache2/mods-enabled/autoindex.conf
    (147) /etc/apache2/mods-enabled/deflate.conf
    (147) /etc/apache2/mods-enabled/dir.conf
    (147) /etc/apache2/mods-enabled/mime.conf
    (147) /etc/apache2/mods-enabled/mpm_prefork.conf
    (147) /etc/apache2/mods-enabled/negotiation.conf
    (147) /etc/apache2/mods-enabled/php7.2.conf
    (147) /etc/apache2/mods-enabled/reqtimeout.conf
    (147) /etc/apache2/mods-enabled/setenvif.conf
    (147) /etc/apache2/mods-enabled/status.conf
    (150) /etc/apache2/ports.conf
    (222) /etc/apache2/conf-enabled/charset.conf
    (222) /etc/apache2/conf-enabled/localized-error-pages.conf
    (222) /etc/apache2/conf-enabled/other-vhosts-access-log.conf
    (222) /etc/apache2/conf-enabled/security.conf
    (222) /etc/apache2/conf-enabled/serve-cgi-bin.conf
    (225) /etc/apache2/sites-enabled/000-catchall.conf
    (225) /etc/apache2/sites-enabled/codingshower.conf

Isn’t that awesome ? Now we know for sure which config files are loaded by Apache and in what order. The numbers that you see on the left most side (146, 147, 222, etc.) are the line numbers where these files get included inside the main configuration file (httpd.conf or apache2.conf).

Hope that helps!

Leave a Reply

Your email address will not be published.