I have two domains (siteA.com & SiteB.com) that point to the same webserver and I would like to show different web pages for each.
The steps I have taken so far are:
Copy the default site (siteA) to siteB
1) sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/siteB
2) sudo vim /etc/apache2/sites-available/siteB
<VirtualHost *:80>
ServerAdmin
[email protected]
DocumentRoot /var/www/siteB
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/siteB>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo Indexes
Order allow,deny
allow from all
</Directory>
</VirtualHost *:80>
Then I created under /var/www/siteB and created a sample index.html in there.
However when I load my domain siteB.com I still get directed to /var/www/siteA. Why is that?
Do I have to rename the /etc/apache2/sites-available/default to /etc/apache2/sites-available/siteA as well?
UPDATE:
Thanks to the answer below it seems I had forgotten next to enabling the site also another entry:
<VirtualHost *:80>
ServerAdmin
[email protected]
ServerName siteB.com
ServerAlias www.siteB.com
</VirtualHost *:80>
in order to include all subdomains as well then do:
<VirtualHost *:80>
ServerAdmin
[email protected]
ServerName siteB.com
ServerAlias *.siteB.com
</VirtualHost *:80>
Same goes for siteA.