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.

How do I dynamically check/list a particular Apache configuration directive? I know that this can be checked manually from httpd.conf file, but is there any other way this can be confirmed/found from a running Apache server process?

For example: In my case, I was checking for KeepAlive configuration directive. I even checked with the command /usr/local/apache2/bin/apachectl -h, but I don't find it here.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

It doesn't look like the apache binary itself will provide this info - from apache docs:

-S

Show the settings as parsed from the config file (currently only shows the virtualhost settings).

There exist options to show modules loaded and compile-time flags used, but the above is the only option related to config settings. It seems even the CGI environment available, as well as info returned by mod_status does not contain the type of details you're looking for.

However, all is not lost - if you're prepared to enable/install the apache module mod_info, you'll find it answers that and many more questions regarding apache configuration.

Example output from the "Server Settings" page of the localhost/server-info location:

Server Version: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny4 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g mod_wsgi/2.5 Python/2.5.2

Server Built: Nov 14 2009 20:23:49 Module Magic Number: 20051115:15
Hostname/port: localhost:80
Timeouts: connection: 300
keep-alive: 300 MPM Name: Prefork
MPM Information: Max Daemons: 150 Threaded: no Forked: yes Server Architecture: 32-bit Server Root: /etc/apache2 Config File: /etc/apache2/apache2.conf

Note the keep-alive highlighted - if your intention is to script the check (although this could also be done against the config file itself), I think calling lynx --dump localhost/server-info could well assist in your endeavour (after a quick call to a2enmod info and an apache restart).

HTH, and YMMV. :)

share|improve this answer
    
Thanks for your comments. I tried to enable Apache module mod_info by following the instructions given here httpd.apache.org/docs/2.2/mod/mod_info.html, but when I invoke http://myserver/server-info, it fails with HTTP 404 Not Found. Of course, I restarted Apache service also. How do I enable/configure this Apache module? –  Gnanam Nov 15 '10 at 5:28
    
Depends which distro you're running and what package management system it is using, really. But first off confirm that the mod_info module is actually loading/loaded into the apache binary, either dynamically or statically. Try the -M and -l flags to the apache binary directly, and see if mod_info or info_module shows up... –  Zayne S Halsall Nov 17 '10 at 13:41

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.