Any Tutorial to create a subdomain?

Posted March 19, 2014 8.4k views
I have followed these steps ( ) to create a virtual host, It's work on simple domains ( ) but on the subdomains ( ) does not work for me. Any help Please!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers
what about the DNS ? I handle subdomains by DO DNS system and works fine
Very simple. Just do these:

1. In the sites-available directory of Apache, make a copy of file and rename it Replace "subdomain" with the name your want to call the subdomain.

2. Edit and modify the ServerName line to show the url of the subdomain and the DocumentRoot line to show where the files for the website will be.

3. enable the subdomain using a2ensite

4. Restart Apache.

5. try to access the site from a browser.

  • dear @finid, please help.
    I followed your steps above for setting up my subdomain. But when i did step #3, I found this:

    ERROR: site does not exist!

    Did I miss something?

The procedure is very simple.

There are two things to do.

first, you need to create a DNS record for your subdomain under your domain like this:

Create A record: hostname -->subdomain and IP address is your droplet IP

Create CName: Name --> *.subdomain and Hostname is (in this example case) -->

And the second part to create a vhost for your Apache at site-available

if you use new version of Apache, then you may need .conf at the end of your site vhost link

remember to give your DNS some time about few minutes to 2 hours to propagate so it becomes valid.

Good luck!!