Category: Apache

As I was working on one of my SaaS services that provides access to free Staging WordPress sites I stumbled on a problem. There are hundreds of sites on that server which are saved in semi random locations. I really needed to find where the virtual host configuration file is for a given site.

Here's video explanation:

Depending on your set up you can have one big apache vhost file that contains all the virtual host definitions and/or also have files for each site that your website server is serving.

To show all the sites that Apache serves run the following command as root.

apachectl -S

The list could be quite long so you can use less command to see the information page per page

apachectl -S | less

Now, if you want to list the location of the virtual host file for a site of yours run this command

apachectl -S | grep -i ''

To list information about the default virtual host

apachectl -S | grep -i 'default'

The output should look like this:

default server localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)
default server localhost (/etc/apache2/sites-enabled/000-default.conf:32)
port 443 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:32)

The thing in the parenthesis is the location of the virtual host file.
e.g. /etc/apache2/sites-enabled/000-default.conf




Join our mailing list

Get important news about cool products we release and invitations to beta test new products
We're working on a secure & flexible WordPress hosting solution. Read for more info (has 1min video)