User Tools

Site Tools


Sidebar

js#vista.png msort nsort

apache2:list_all_hosts

List all Hosts

Sometimes you will need to get a list of all hosts/domain/sub-domains your apache server is configured to serve. Here is a quick and easy way that lists all ServerName and ServerAlias entries in your configs:

blogs:/# cd /etc/apache2/sites-enabled/
blogs:/etc/apache2/sites-enabled# THECONFS="`ls`"; for ACONF in ${THECONFS}; do cat ${ACONF} | tr '\t' ' ' | grep -E '^ *(ServerName|ServerAlias)' | sed -r 's/^( |ServerName|ServerAlias)+//g' | tr ' ' '\n'; done | sort -fu
bdb.mol.vs.bluedotmedia.de
bluedotmedia.de
itadmins.net
preview.bluedotmedia.de
www.bluedotmedia.de
www.itadmins.net
blogs:/etc/apache2/sites-enabled# 
apache2/list_all_hosts.txt · Last modified: 2020/02/24 11:16 (external edit)