Deploying multiple domains to 1 droplet

December 4, 2014 993 views

I have two domains and their name servers pointing back to my droplet. However when I type in either domain name into my browser they both go to the first domain that I setup. How can I fix this so they each go to their correct domain?

Quick reply is much appreciated!

1 comment
  • Hi skyler. are you using Apache or Nginx?

    if Apache, you should set up virtualhosts ...not too difficult.

    Do you have access to sftp and a way to edit files on your server?

1 Answer

If you are using Apache you will need to set up VirtualHost entries for each domain you want directed to it's own site. This tutorial will walk you through the process.

If you are using nginx you would set up server blocks which function in much the same way as Apache VirtualHosts. This tutorial will assist you with setting up nginx server blocks.

by Justin Ellingwood
The Apache web server is the most popular way to serve web content on the internet. Apache has the ability to serve multiple domains from a single server by using a mechanism called "virtual hosts". If a virtual host is configured correctly for each domain, the web server can correctly route traffic to the appropriate files based on the domain name requested. In this guide, we'll demonstrate how to configure Apache virtual hosts on an Ubuntu 14.04 VPS.
Have another answer? Share your knowledge.