How to List All Virtual Hosts in Apache Web Server installed on Ubuntu 20.04.2 LTS?

How may I enable all the Virtual Hosts in Apache Web Server and know if they are enabled or not?

3

2 Answers

On Ubuntu this version works best and produces a list of all sites enabled and their aliases

 sudo apache2ctl -S

You can also run below one liner script for listing all enabled current hosted webiste in ubuntu apache. this will show output accordingly.

cd /etc/apache2/sites-enabled/ && echo -e "\nListing all enabled website and its home directory for server $(hostname -I):-\n$(cat $(ls) |grep -i 'ServerName\|DocumentRoot')\nReport Timestamp:- $(TZ='Asia/Kolkata' date)\n"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like