I would like to make two subdomains for my site. To do so, I have created three VirtualHosts in my default
file under sites-available (I am using Apache on Ubuntu):
<VirtualHost 127.0.0.1>
ServerName nmagerko.me
...
DocumentRoot /var/www
...
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName sub1.nmagerko.me
...
DocumentRoot /some/different/path
...
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName sub2.nmagerko.me
...
DocumentRoot /some/different/path2
...
</VirtualHost>
However, I am not sure of what to do after this point. I have each of these subdomains and my primary domain in my /etc/hosts
file as 127.0.0.1
and I have set A Records for sub1
and sub2
in my domain registrar's domain editor. However, these A Records point to the same IP as my primary domain, since this is all being hosted on one system... which isn't very useful. So, when I go to sub1.nmagerko.me
in my browser, I receive the same site as I would have as if I went to nmagerko.me
.
Any suggestions on how to proceed?