How to create a sub-domain in Linode
- Login to Linode Members Area
- Go to the DNS Manager tab.
- Click the domain name you want to put the sub-domain to.
- Scroll to the middle of the page and look for the A/AAAA Records.
- Click on Add a new A/AAAA Record
- 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.
- For the IP Address, input the IP address of your server.
- Click Save.
SSH to your server
- SSH to your server.
- Once you are logged in as root, create a user called ‚Äúshop‚Äù (same as your sub-domain name).
- Go to: /etc/apache2/sites-available OR enter this command:
- If you do an
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
- Copy the default file into your new sub-domain file. You can issue this command:
cp default shop.mydomain.com
- Open up shop.mydomain.com in VI.
- Make the new file look like this:
ServerAdmin email@example.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
- The next obvious thing to do is to create the directory structure found above. So just do something like this:
- Enable the site by issuing this command:
- Then refresh Apache by using this command: