We start this step by going into the configuration files directory:
cd /etc/apache2/sites-available/
Since Apache came with a default VirtualHost file, let’s use that as a base. (gci.conf
is used here to match our subdomain name):
sudo cp 000-default.conf gci.conf
Now edit the configuration file:
sudo nano gci.conf
We should have our email in ServerAdmin
so users can reach you in case Apache experiences any error:
ServerAdmin yourname@example.com
We also want the DocumentRoot
directive to point to the directory our site files are hosted on:
DocumentRoot /var/www/gci/
The default file doesn’t come with a ServerName
directive so we’ll have to add and define it by adding this line below the last directive:
ServerName gci.example.com
This ensures people reach the right site instead of the default one when they type in gci.example.com
.
Now that we’re done configuring our site, let’s save and activate it in the next step!