Subdomain on a different server
I want to develop my first Node.js applications and host it as subdomain, but this server (shared on hostgator) does not support Node.js applications, and for a second I thought if I need to change server only for this?. But nope, there is a solution for this.
What I want
- Host a Nodejs application in subdomain (_subdomain.wellingguzman.com) on a server that does not support nodejs.
- Keep it like if it was hosted on the same server.
Solution
- Go to your hosting provider, and look for DNS Zone, on hostgator is under domains tab.
- Add a Record, put the Name of the host, or subdomain (subdomain.wellingguzman.com), there is possible two types you would need, type A or CNAME. If you want to point to an IP you need a type A, but if you want to point to a domain/subdomain you need CNAME.
On Address/CNAME put the server's IP or subdomain, in my case the app is hosted on OpenShift and the CNAME would be something like nodejs-welling.rhcloud.com.
TTL is Time to Live, amount of seconds the record cache would last.
This would do the trick, and every time subdomain.wellingguzman.com is typed it would request nodejs-welling.rhcloud.com.