Question

Setup sub-domain from a different host pointed to droplet running Apache

Given I have an example.com domain hosted on a different name-server different from Digital Ocean’s. Tutorials and links say to add an A record for the sub-domain using the DNS manager of the current host. I did that and added an app.example.com sub-domain and pointed it to the IP address of the droplet running the application to be hosted on the sub-domain.

Now, the A records look like so

Zone id. 	************

Record Id 	***********

Name 	app.example.com

Class 	IN

Type 	A

Status 	Active

Value 	dropletIPAddressHere

TTL 	7200

Creation Date 	2019-05-15 03:54:22.909377 

Now, in my droplet, I have Apache configured like so

        ServerName app.example.com
        ServerAlias www.app.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/html>
                AllowOverride All
        </Directory>

However, I still can’t reach the application through the sub-domain URL but using it’s IP address things work just fine. Is there anything I still need to do on my end? Please help!!!


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

The way that you’ve configured both your DNS and your Apache Vhost look correct, note that it might take between 1 and 72 hours for the DNS to propagate over the Globe before your domain name actually starts resolving from the new IP address.

Hope that this helps! Regards, Bobby