Display a list of all available DNS:
/usr/sbin/apache2ctl -S 2>&1 | awk '/namevhost/ {print $4;} '
Or you could use the following command
# apache2ctl -S
And with some awk magic have it in the desired format:
# apachectl -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" };'
Lista the file path for all vhost certificates:
grep -n “Certificate” /etc/apache2/sites-available/* | grep ‘crt|key’
or you you want only uncommented lines:
grep -vnr '#' /etc/apache2/sites-available/* | grep 'crt\|key\|ServerName'