HowTo setup vhosts for multiple Instances of WordPress

Disclaimer (again):

I am just writing what I did, you should decide for yourself if it is a good idea to copy it. I am not responsible for any damages or wasted time from following these instructions.

I am still motivated to write something here, so i write the second part of the HowTo, before i get too lazy again.

If you read the last entry, you will have a second wordpress-instance that is done setting up – at least from the server point of view…

To make it work, you probably need to configure virtualhosts in apache.

Therefore you need to edit some conf-files. Enter the directory with

cd /etc/apache2/sites-available/

At least there should be a file called 000-default.conf. In it is defined what a “user with a webbrowser” will be shown when $yourdomain.$yourtld is entered.

To be honest: I really dont care whats in it…. The following conf is copied from and changed for you:

<VirtualHost *:80>
        DocumentRoot /var/www/diemo_best/wordpress
        <Directory /var/www/diemo_best/wordpress>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        ErrorLog ${APACHE_LOG_DIR}/error.log
        # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined

Relevant lines: ServerName, ServerAlias, DocumentRoot and <Directory.

You need to change these to your needs. For example if the domain you own is “” and you want to show the wordpress-site on “”, your servername and serveralias should be “”.

The DocumentRoot and Directory should point to your wordpress-directory (see last post).

If you have another instance of wp running on your server, then this would probably have the following effect:

People who enter “” would see the other instance. Only people who enter “” – and people that are directed there by a search-engine, obviously – will see the new wordpress-instance. Every other subdomain will get redirected to “” and to your other instance.

If you want to change the default behaviour… well… you have to change the 000-default.conf.

It is most likely longer than my example above, but you will be able to identify the relevant parts to change it to your liking.

Now all you have to do is to restart apache and go to your new site in your browser.

Have fun!

A relevant addition:

Dont forget to create a DNS-Record for your sub- or second domain that points to your server. Doing that will make it possible to work – keep in mind that it needs to propagate through the dns-system. That will take a while. If you are like me youll have a nice break now, because everything is done except the DNS-Record, which takes about 30 minutes up to several hours. Take that break, you have earned it. 😉