Get a list of all virtual hosts which are defined in all apache configuration files

Have you ever looked in the apache config files to see where a website’s virtual host is defined? The apache2ctl script has a useful option that could come in good here. When you execute the command, it should look like this:

apache2ctl -S

You’ll obtain a list of all virtual hosts and default servers in the shell, along with the line number where they’re declared. Example:

~# apache2ctl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:8080                 is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-ispconfig.vhost:10)
port 8080 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-ispconfig.vhost:10)
*:8081                 is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-apps.vhost:10)
port 8081 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-apps.vhost:10)
*:80                   is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com.vhost:7)
Syntax OK
Sponsored

Thanks to Planetfox for this tip.

Sponsored

The post Get a list of all virtual hosts which are defined in all apache configuration files appeared first on FAQforge.

Ubuntu Server Admin

Recent Posts

Ubuntu Weekly Newsletter Issue 868

Welcome to the Ubuntu Weekly Newsletter, Issue 868 for the week of November 24 –…

2 hours ago

Industrial cybersecurity: the journey towards IEC 62443 compliance

Industrial cybersecurity is on every CISO’s mind as manufacturers strive to integrate their IT and…

8 hours ago

Xfce 4.20 Pre2 Released

Dec 01,2024 Xfce 4.20 Pre2 Released Dear Xfce community, I am happy to announce the…

13 hours ago

How to Install Miniconda on Ubuntu 24.04

Anaconda is a package, dependency function, and environment management. As environment management for programming languages,…

1 day ago

Entra ID authentication on Ubuntu at scale with Landscape

In September we introduced Authd, a new authentication daemon for Ubuntu that allows direct integration…

5 days ago