1. Login to Linode Members Area
  2. Go to the DNS Manager tab.
  3. Click the domain name you want to put the sub-domain to.
  4. Scroll to the middle of the page and look for the A/AAAA Records.
  5. Click on Add a new A/AAAA Record
  6. In the Hostname input box, input the sub-domain you want. For example, if you want blog.mydomain.com, enter “blog” in the input box.
  7. For the IP Address, input the IP address of your server.
  8. Click Save.

SSH to your server

  1. SSH to your server.
  2. Once you are logged in as root, create a user called “shop” (same as your sub-domain name).
  3. Go to: /etc/apache2/sites-available OR enter this command:
    cd /etc/apache2/sites-available
  4. If you do an
    ls -la

    you should see something like this:

    -rw-r--r-- 1 root root   385 Apr 24 02:21 default
    -rw-r--r-- 1 root root  7364 Mar  9 21:19 default-ssl
  5. Copy the default file into your new sub-domain file. You can issue this command:
    cp default shop.mydomain.com
  6. Open up shop.mydomain.com in VI.
  7. Make the new file look like this:
         ServerAdmin admin@mydomain.com
         ServerName shop.mydomain.com
         ServerAlias www.mydomain.com
         DocumentRoot /home/shop/public_html/
         ErrorLog /home/shop/logs/error.log
         CustomLog /home/shop/logs/access.log combined
  8. The next obvious thing to do is to create the directory structure found above. So just do something like this:
    mkdir /home/shop/public_html/
  9. Enable the site by issuing this command:
    a2ensite shop.mydomain.com
  10. Then refresh Apache by using this command:
    /etc/init.d/apache2 reload