Blog Madness

e-Marketing tips

Saturday, March 24, 2012

How to print a list of domains in apache

Use the following command to print a list of domains in your Apache:

httpd -S 2>&1 | perl -ne 'm@.*port\s+([0-9]+)\s+\w+\s+(\S+)\s+\((.+):.*@ && do { print "$2:$1\n\t$3\n"; $root = qx{grep DocumentRoot $3}; $root =~ s/^\s+//; print "\t$root\n" };'