Report this

What is the reason for this report?

Any Tutorial to create a subdomain?

Posted on March 19, 2014

I have followed these steps ( https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts ) to create a virtual host, It’s work on simple domains ( example.com ) but on the subdomains ( sub.example.com ) does not work for me. Any help Please!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Very simple. Just do these: <br> <br>1. In the sites-available directory of Apache, make a copy of yoursite.com file and rename it subdomain.yoursite.com. Replace “subdomain” with the name your want to call the subdomain. <br> <br>2. Edit subdomain.yoursite.com 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. <br> <br>3. enable the subdomain using a2ensite subdomain.yoursite.com <br> <br>4. Restart Apache. <br> <br>5. try to access the site from a browser. <br> <br>

The procedure is very simple. <br> <br>There are two things to do. <br> <br>first, you need to create a DNS record for your subdomain under your domain like this: <br> <br>Create A record: hostname -->subdomain and IP address is your droplet IP <br> <br>Create CName: Name --> *.subdomain and Hostname is (in this example case) --> subdomain.domain.com. <br> <br>And the second part to create a vhost for your Apache at site-available <br> <br>if you use new version of Apache, then you may need .conf at the end of your site vhost link <br> <br>remember to give your DNS some time about few minutes to 2 hours to propagate so it becomes valid. <br> <br>Good luck!!

what about the DNS ? I handle subdomains by DO DNS system and works fine

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.