Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a command / tool to generate the computed configuration that Apache httpd is using? I know I can manually go through the httpd.conf and other configuration files, but is there a standard tool to generate a configuration of all included files and sections that apply, for convenience?

Thanks,

James

Edit: I should also have mentioned I'm also using a Windows x-64 version of Apache, from a pre-built binary.

share|improve this question
    
+1 for great question! I've been administering Apache for more than ten years and only now I realized I have always glimpsed through configuration files instead of the kind of view you are asking for. It sure would be nice to have a view similar to phpinfo() in PHP. :-) –  Janne Pikkarainen Jun 14 '11 at 9:23
    
@Janne thanks :) I've used Maven before on Java projects as a build tool, which uses various 'POM' XML files for configuration (in various folders) and has a way to do such a thing - view all combined files as one generated POM. I think such a tool is invaluable when trying to sort out configuration –  jamiebarrow Jun 14 '11 at 10:19
add comment

1 Answer

There is an Apache module available which shows a detailled page with various settings and the active configuration.

mod_info is disabled by default and must be enabled with ./configure --enable-info when building Apache. On Debian and Ubuntu, this module and its configuration can be enabled using sudo a2enmod info.

Put the next lines in your configuration file (httpd.conf) (not necessary when using a2enmod):

<Location /server-info>
    SetHandler server-info
</Location>

After restarting the server, the configuration file is available at http://example.com/server-info?config (replace example.com with your server address)

Note that this information is quite sensitive, you might want to restrict access as in:

<Location /server-info>
  SetHandler server-info
  Order deny,allow
  Deny from all
  Allow from yourcompany.com
</Location>

For more information, see http://httpd.apache.org/docs/2.2/mod/mod_info.html

share|improve this answer
    
Thanks for your suggestion. I guess it is one way of doing it, but I'm looking for a more offline solution - especially with the access control concerns. I think I'd also suggest using some random path instead of /server-info just in case :) –  jamiebarrow Jun 14 '11 at 10:22
    
/server-info is the default path, hence I'm using it to avoid confusion. Security-wise, you would indeed use a different path with strict access control and disable it after you're done. You could set up Basic/Digest authentication, restrict access to localhost and use curl combined with html2text to get the data in a script. –  Lekensteyn Jun 14 '11 at 10:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.