Setup subdomain in digital ocean and namecheap

I had bought a domain in namecheap, and want to setting up my subdomain in digital ocean. Currently I only had one droplet and running ubuntu linux 14.04. My site was running in grunt at null:3000 which is localhost:3000. In apache2 conf, I had used proxypass redirect to my site. Right now, things are getting weird, my works yesterday, but today doesn’t work anymore.


Digital Ocean


<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/mydomain

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/subdomain

        <Directory /var/www/subdomain>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
                Require all granted

        <Location />
                ProxyPass http://localhost:3000/
                ProxyPassReverse http://localhost:3000/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


/etc/apache2/sites-available/000-default.conf used for /etc/apache2/sites-available/ for subdomain. I had used a2ensite command to activate my subdomain, but the site doesn’t work, it show the site can’t be reached. Currently, both sites doesn’t work.

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.

Accepted Answer

Hi @catergogo

If you have setup your domain to use DigitalOcean’s name servers via your registrar (which in your case is NameCheap), then you only need to configure DNS records via DigitalOcean. But note that changing name servers can take up to 48 hours, so your domain might be going in-and-out if the DNS records are not the same at both the old and new NS.

It would help a lot more if you posted your domain, but otherwise you can check the current name servers, A/CNAME/etc records with this command:

dig NS
dig A

Your Apache configuration looks correct, so this it probably just a domain issue. Just to make sure of that, run sudo apachectl configtest.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel