0

I have a VPS which is running Windows server 2008 datacenter with one Static IP address.

I can access from Internet to my web services by specific port e.g mydomain.com:3000/api and mydomain.com:4000/api. I want to change this web services access address into sub domain method (child) like App1WS.mydomain.com/api and App2WS.mydomain.com/api

I add this line to host file

127.0.0.1      mobileapp.myrealdomain.com

Then in nginx, I add these lines at the end

 server {
        listen       80;
        #root html;
        root c:/apps/web;
        server_name  mobileapp.myrealdomain.com;
       location / {
           proxy_pass  "http://127.0.0.1:3000";
        }
}

Then I started my loopback project which is accessible via:

C:\apps\mobileapp>node .
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer

Then I've add Alias(CNMAE) record to DNS:

alias name: mobileapp
FQDN: mobileapp.myrealdomain.com
FQDN for target host: 127.0.0.1:3000.

From other location on Internet myrealdomain.com loads homepage but still mobileapp.myrealdomain.com showing

server DNS address could not be found.

In VPS mobileapp.myrealdomain.com works properly and loads server up time

{"started":"2017-09-23T10:29:30.626Z","uptime":48.709}

update:

result of testing:

enter image description here

enter image description here

RSA
  • 1,417
  • 4
  • 22
  • 37
  • 1
    DNS (mostly) doesn't handle ports, so if your api was reachable using `mydomain.com:3000/api`, remove the `CNAME` you added and use this one: `mobileapp.myrealdomain.com CNAME myrealdomain.com`. Nginx will do the proxying to the correct port. – Dusan Bajic Sep 23 '17 at 17:28
  • Dear @dusan-bajic I did but nothing is changed, I've add: `alias name: mobileapp FQDN: mobileapp.myrealdomain.com FQDN for target host: myrealdomain.com` I also made a child and add cname but still the same. – RSA Sep 23 '17 at 18:12
  • 1
    If you go to https://toolbox.googleapps.com/apps/dig/ and test `A` records `mobileapp.myrealdomain.com` and `myrealdomain.com`, do they resolve to the same IP address? – Dusan Bajic Sep 23 '17 at 18:29
  • I add photo of A and CNAME to the main post. – RSA Sep 23 '17 at 18:52
  • 1
    DNS propogation takes time. Please try `ping mobileapp.myrealdomain.com` from the machine where it doesn't work. When the ping shows you the ip then only you can test. DNS updates can take anywhere between 30mins to 2 days also depending on different conditions. So if you are in a hurry to test if the server works fine or not. Then on the machine you are testing make a host entry `51.XXX.104.172 mobileapp.myrealdomain.com` and then test. If it works then that means you are just waiting for DNS changes to propogate – Tarun Lalwani Sep 24 '17 at 06:18
  • Dear@TarunLalwani and @DusanBajic I don't know what was wrong yesterday. but the same rule with CNMAE that you already told me, today works fine. I tried several subdomains for other web services and they start right after DNS and nginx restarted. Thank you so much. – RSA Sep 24 '17 at 09:31

0 Answers0