Saturday, November 24, 2018

nginx - how to redirect child domains to specific localhost ports in windows server 2008 VPS?

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




update



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}

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...