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.
It doesn't look like the apache binary itself will provide this info - from apache docs:
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:
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 toa2enmod info
and an apache restart).HTH, and YMMV. :)