Is there any way to get the Apache web server to display it's current running config, from memory, i.e. not by parsing the files in the config directories?
I've just managed to accidentally over-write the vhost config on a server (yes, I know, should have had a backup!), and while I can reconstruct it fairly easily (very new server, so simple config and hence no backup yet - that was tomorrow's task), was wondering if in general there was any way to get Apache to display its live running config, rather than just parsing the files (as httpd -S seems to do).
Have tried Googling and searching here on ServerFault, but not found anything. I can imagine this might save a few people's bacon over time. :)
This is how to recover Apache2 config from memory :
the Dump a linux process's memory to file
./dump-all-memory-of-pid.sh [pid]
pid-startaddress-stopaddress.dump
gdb
get the pid of your apache process
dump the process's memory
grep all of the dump files for something that you expect to be in the apache config file.
open the matched dump file(s) in vim and search for the string.
Search by typing "/", eg "/DocumentRoot", then simply copy out the text that you want.
source : http://forums.whirlpool.net.au/archive/2189742