Setting Up Multiple Domains on Apache with Godaddy

all about tech.
Post Reply
Site Admin
Posts: 16
Joined: Thu Aug 01, 2019 3:16 am
Setting Up Multiple Domains on Apache with Godaddy

Post by george » Sun Sep 13, 2020 10:38 pm

In this guide we will discuss how to setup multiple domains and configure them with apache on Ubuntu.

I have a domain ( that forwards to the root directory of my webserver (/var/www) with dynamic DNS. I also have another domain ( which i wanted to forward to /var/www/wavebuddha), but I wanted to show up in the URL bar, not

Here’s what I did:

1) on godaddy (in the configuration for, I created an A record which points to my IP address (dynamic unfortunately, but I can live with changing it OR use this script to update it automatically

2) also create a CNAME www record with

3) on the apache side, I created a .conf file in /etc/apache2/sites-available called "wavebuddha.conf":

Code: Select all

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wavebuddha
ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined
4) then i added the .conf file i made with the contents above to apache by running the cmd line command:

Code: Select all

sudo a2ensite wavebuddha.conf
5) and then I reloaded apache:

Code: Select all

sudo service apache2 restart
Understanding things
Even though we are forwarding a domain that lives in a subfolder ( to, which you would think forwards that URL to the root webdirectory (/var/www), the key line is "DocumentRoot /var/www/wavebuddha" in etc/apache2/sites-available with the servername and serveralias set to Apache can tell when you send someone to where the request is coming from and route them to the correct folder. It is kind of confusing but it works because of the .conf file.

Post Reply