Apache Web Server Dump Current Running Configuration Settings

Have you ever found yourself badly needing to export or view all the configuration keys and values in effect for your Apache HTTP Server setup ? Let’s consider some cases:

  • You make some configuration changes for httpd but then on a restart you don’t see the expected behaviour. You’re wondering if the changes took effect or not.
  • You just want to find answers to questions like what is the system user and group httpd is running as or where is the pidfile located. Sure you could find these answers by going through the main configuration file (httpd.conf or apache2.conf) but how about a dump that gives you answers to these questions and more ?
  • You set up a brand new Apache Web Server instance but it ain’t functioning like the other one in the same cluster. Could there be a mismatch in the configuration ?

Well if you find yourself going through anything like that or just want to have a place that lists all the configuration directives and their values for the current running httpd daemon, then let’s see how it can be done.


The apachectl program ships with most of the popular Linux distributions acting as a frontend to the actual daemon server. It can be used to perform various administrative functions. There are a few options that it provides via which we can inspect various kinds of configurations in effect for our setup.


The apachectl -D DUMP_RUN_CFG option simply parses all the configuration files and prints a bunch of “run” settings to the standard output.

# apachectl -D DUMP_RUN_CFG
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
User: name="www-data" id=33
Group: name="www-data" id=33

As you can see it doesn’t really print all the configs in the world but answers some questions like what system user/group will the httpd server run as, where is the pidfile located, where is the server root, what location acts as the document root for the main server, etc.


Then there is -D DUMP_VHOSTS that parses the config files and dumps the vhost settings. It has been well explained here.

# apachectl -D DUMP_VHOSTS
*:80                   is a NameVirtualHost
         default server catchall (/etc/apache2/sites-enabled/000-catchall.conf:1)
         port 80 namevhost catchall (/etc/apache2/sites-enabled/000-catchall.conf:1)
         port 80 namevhost codingshower.com (/etc/apache2/sites-enabled/codingshower.conf:1)


The -D DUMP_MODULES option spits out all the static and dynamic modules loaded/enabled in the current setup.

# apachectl -D DUMP_MODULES
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)


-D DUMP_INCLUDES will give you all the various configuration files included in the main server configuration file (httpd.conf or apache2.conf).

# apachectl -D DUMP_INCLUDES
Included configuration files:
  (*) /etc/apache2/apache2.conf
    (146) /etc/apache2/mods-enabled/access_compat.load
    (147) /etc/apache2/mods-enabled/status.conf
    (150) /etc/apache2/ports.conf
    (222) /etc/apache2/conf-enabled/charset.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

Dump Full Config

Well, based on the outputs we just saw in the previous sections, none of them really give us a full comprehensive list of all the configuration directives and their values. What would be really preferable is a program that could go through all the files from the output of apachectl -D DUMP_INCLUDES, merge the contents recursively and export it all in a single place. Also beyond what we can just see in the config files, there might be additional config in effect that were either passed on during httpd startup or are set within some of the static and shared modules used by the server. Those details are important too!


The mod_info module does just that. It provides a comprehensive overview of the server configuration. Let’s see how to quickly enable it and list the entire configuration of the running server in a single page.

First, enable the module. For this you need to put the following in your main configuration file:

LoadModule info_module /usr/lib/apache2/modules/mod_info.so

Note: If you do not know the location of the module, then locate mod_info.so or find / -name mod_info.so should do the trick.

Note 2: On Ubuntu/Debian, you could just run a2enmod info to enable the module.

Secondly, put the following config into your virtual host:

<Location /server-info>
    SetHandler server-info
    Require all granted

What this config does is allows connections to the /server-info path/endpoint/route which will be served by a handler called server-info provided by mod_info. The server-info handler takes care of collating all the configurations in a single place.

Note: Instead of Require all granted you might want to use Require local or Require ip local-ip to restrict access to the /server-info endpoint. Using mod_auth_basic to set up HTTP Basic Authentication for the virtual host where you put the above config might be even better. This piece of information should not be publicly accessible.

Finally, visit http://yoursite.com/server-info to view an entire list of all the configurations set for the running Apache HTTP Server. It should look like this:

Mod Info Config Page
yoursite.com/server-info being served by mod_info

A looong page with lots of information and scrolling. Try appending the following for a drilled down view of specific sections:

  • ?<module-name> – Information relevant to the module name.
  • ?config – Just the configuration directives across all files and their values.
  • ?hooks – List of hooks each module is attached to.
  • ?list – List of enabled static and shared modules. Similar to apachctl -D DUMP_MODULES.
  • ?server – Basic server information, similar to apachectl -V.
  • ?providers – List of all the providers made available by the loaded modules.


The apachectl program should be able to give you most of the relevant details as far as httpd configuration debugging goes but if you ever need to do a detailed analysis then mod_info is the way to go.

Leave a Reply

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