Install Subdomain Using Apache on Dyndns Server

Hits: 420

*Since writing this post many years ago, I have been turned off to DynDNS. I now mostly use AWS cloud instead of self hosted servers, seems cheaper than the electricity. I also use Route53 as my very preferred DNS.

 

I recently switched this site from being a subdirectory in my domain to being a subdomain. I am using Ubuntu 13.04 known as  Raring, Apache 2, Dyndns and WordPress  7.01 for  this article.

I have several subdirectories dealing with totally different content.

My newest site is this Linuxguru blog. I hope to make some money finding Consultant work throughout the world and another little bit  with Google Adsense.

It was installed as milknhoney.co.il/linuxguru (will now  give you 404 since it has moved)

I wanted to change it to being it’s own subdomain of http://linuxguru.milknhoney.co.il

 

  • I first created a file using vi in /etc/apache2/sites-available I named it after  my new subdomain linuxguru. You do not need to call it .conf

<VirtualHost *:80>
DocumentRoot /var/www/linuxguru
ServerName linuxguru.milknhoney.co.il

ErrorLog /var/log/apache2/error.linuxguru.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.linuxguru.log combined
</VirtualHost>

 

  • In order to test whether Apache2 was working properly, which it wasn’t, I updated update /etc/hosts with the new full subdomain name linuxguru.milknhoney.co.il

192.168.5.7  localhost   www.milknhoney.co.il  linuxguru.milknhoney.co.il

Opening up the web site in my browser, apache gave me a license error produced by a different software. I , wrongly figured maybe that software needed to know about the new subdomain.  So I updated dyndns at http://dyn.com/ who manages my dns service.

I did this in the zone settings.

linuxguru.milknhoney.co.il CNAME

Still I had the license error. I then checked logs,  at /var/logs/apache2 , which had nothing.

I then updated WordPress which I use for this blog in Settings –> General . I Changed it and  Wordpress and got even worse  errors from WordPress when opening the old subdirectory and the same license error when trying the new subdomain.

worpressgenralsettings

Finally  I remembered  that there is a subdirectory called /etc/apache2/sites-enabled. The files here are supposed to be links to /etc/apache2/sites-available

so I did:

  • From a shell using konsole I made the needed link,  cd to etc/apache2/sites-enabled

sudo ln -s ../sites-available/linuxguru linuxguru

  • give your password