1

I am trying to setup a Nodejs + Angularjs application on digitalocean. I separated the frontend(angularjs) and backend(nodejs) into two nodejs servers each running on ports 3000 and 4000 respectively. I want the angularjs app to be served on mydomain.com and the backend server to be served via the subdomain api.mydomain.com. My nginx configuration is:

server {
    server_name mydomain.com;
    location / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $proxy_host;
       proxy_set_header X-NginX-Proxy true;  
       proxy_pass http://127.0.0.1:3000;
    }
}    

server {
    server_name api.mydomain.com;
    location / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $proxy_host;
       proxy_set_header X-NginX-Proxy true;  
       proxy_pass http://127.0.0.1:4000;
    }
}

The following is the DNS configuration for the droplet:

Type     Host                  Value                   TTL
A   api.mydomain.com  directs to IP_ADD_OF_DROPLET    3600
A   mydomain.com      directs to IP_ADD_OF_DROPLET    1800
NS  mydomain.com      directs to ns1.digitalocean.com 1800
NS  mydomain.com      directs to ns2.digitalocean.com 1800
NS  mydomain.com      directs to ns3.digitalocean.com 1800

mydomain.com is configured to used the 3 digitalocean nameservers (ns_.digitalocean.com)

I need help regarding this, so that the api server is accessible (api.mydomain.com).

  • Your problem is with your DNS setup so you need to provide more information about your DNS configuration. – AlexD Jun 10 '17 at 12:24
  • I have updated the question. – Uppinder Chugh Jun 10 '17 at 14:55
  • Please provide full output of dig @8.8.8.8 api.mydomain.com and dig @ns_.digitalocean.com api.mydomain.com – AlexD Jun 10 '17 at 15:29
0

The NS records for mydomain.com are pointing to the ns37.domaincontrol.com and ns38.domaincontrol.com which belong to GoDaddy so no one knows about your settings on ns_.digitalocean.com. You need to set NS records in your domain control panel on your domain registrar (I assume GoDaddy) to point to the Digital Ocean name servers or alternatively create necessary A records for @ and api on your domain control panel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.