How to host a sub domain on another droplet ?

March 24, 2013 2.4k views
I want to host the www (main domain ) on one droplet and the subdomain on another droplet (ip). I've set up a LEMP stack on both droplets and created an A record on the DNS section for the sub domain. but it's not working, what else I should do ? when I type the address of sub domain it gives me this err: "Oops! Google Chrome could not find" PS: main domain is working properly
1 Answer
First step is to ping the subdomain to make sure that it resolves to the IP of the second server. If it does that means that the DNS is setup correctly.

After that just browse to the IP of the second server in your browser:

This will allow you to test if your web server is working on the second virtual machine. You can also configure nginx to return the same content as the subdomain on the IP this way you can test to make sure that your nginx config is correct.

If both of the above are true then the subdomain should be working for you in the browser.
Have another answer? Share your knowledge.