How to create a sub domain?

Posted October 28, 2019 1.6k views
ApacheDigitalOceanDNSConfiguration ManagementControl PanelsApplications

I added CNAME and configured virtual host perfectly, but sub domain not working, please help me anyone…

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
1 answer


If this is going to be a separate website, I would recommend adding an A record for your subdomain name rather than CNAME. That way if the A record for your main domain changes, it would not affect your subdomain.

Also, note that it could take between 1 and 72 hours for the DNS cache to clear over the Globe before you could see your new DNS records.

If you are still experiencing the issue, you could share your Vhost here and I could try to advise you further.


  • I am also used A record but no use, this is my vhost

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory /var/www/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined