In my previous post, I told you guys about installing multiple WordPress instances in a single VM. You can have your own reasons for doing that, but let's say you don’t want to create another VM in the cloud or configure a whole new server for your blog or website; and wanted to use existing server, VM, or OS so that's why you needed two WordPress instances. In this scenario, you’ll be needing multiple domains and your other WordPress instances will be installed in the sub directory.
In this case, your domain should be pointing at a sub directory, but DNS doesn’t work like that – either it’s CNAME or A record – you cannot point your domain to sub directory in DNS setting.


Here, DNS has failed to serve you, but Virtual Host will help you. Virtual host is a method in which you can host more than one website on a single machine.
In this tutorial, I’ll be using a real world example. My main website which resides at main public http folder is “www.forgeknives.com” and other website sitting in sub directory is “www.samknives.com” (main_website/samknives), public URL is “knives.southeastasia.cloudapp.azure.com” VM is installed in Microsoft Azure and I’m using Bitnami LAMP stack.
DNS Setting
Head to your domain provider, namecheap in my case, and point both domains to a Public URL or Public IP of your server, meaning, add CNAME or A Record respectively. In my case, I’m using Public URL which is “knives.southeastasia.cloudapp.azure.com”.


Don’t worry, let the server do the work.
Add Virtual Host Information in httpd.conf Files
If you have searched about adding vHosts you’ll come across the information where people have said to edit files like /etc/httpd/httpd.confor/etc/apache2/apache2.conf like the solution in this SuperUser thread. Well, they are right, but the problem is – it doesn’t work like this in Bitnami LAMP stack.
Connect to your VM because you're about to edit some files on the server.
If you are using Bitnami stack, your “httpd.conf” will be /opt/bitnami/apps/wordpress_instance/conf/httpd-vhosts.conf.
Edit files of both of your instances, i.e
/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf
/opt/bitnami/apps/samknives/conf/httpd-vhosts.conf
Insert the following information in the files
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.









path2hike ITExamsPosted Sep 25, 2018, 1:42 PM
Very helpful