Adding second site to a droplet

Posted April 24, 2014 5.7k views
So i have a live working site on my droplet, but its a small project with little traffic. I wanted to go ahead and add another project on there and route it using a different domain name. I have as (as far as I can tell) pushed the projects repository to the server and set up the DNS forwarding; but for whatever reason my first site is up and working ( and my second site ( shows nothing when i go to it. Hoping for any help trouble shooting this problem; also whenever I do an ls -la inside my server from the command line I cannot find either projects directory on the server this is all i get: root@Vindit:~# ls -la total 44 drwx------ 7 root root 4096 Apr 24 19:47 . drwxr-xr-x 22 root root 4096 Apr 18 20:38 .. drwxr-xr-x 3 root root 4096 Apr 18 20:36 .ansible drwx------ 2 root root 4096 Apr 23 22:03 .aptitude -rw------- 1 root root 1338 Apr 24 20:00 .bash_history -rw-r--r-- 1 root root 3106 Oct 28 2012 .bashrc drwx------ 2 root root 4096 Oct 18 2013 .cache drwxr-xr-x 3 root root 4096 Apr 18 21:47 .composer -rw-r--r-- 1 root root 0 Apr 9 19:50 .mysql_history -rw-r--r-- 1 root root 140 Oct 28 2012 .profile drwx------ 2 root root 4096 Apr 18 19:16 .ssh -rw------- 1 root root 1732 Apr 24 19:47 .viminfo any help is appreicated.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers
I could be wrong having never tried it, but add the second domain to your severs IP (either via your domain registers panel or DO's DNS panel; however you have your domain set up).

then go to your /etc/host file and add the domain as you would any other domain

Create the directory and add your site files, then
# chown -R www-data:wwwdata /path/to/your/site/dir
(www-data is the user and group for apache)

then you just create the vhost file, in Ubuntu it would be located in:
//Please note the version of apache you are using as it will effect how you set that file up. Simplest way to find out is googling your distro version setup apache vhost. Each distro is different. Also note that different sites (such as drupal vs wordpress) may have different configurations for the vhost.
We'd need some more specifics about what your current set up is to help you? Do you know what web server you are using (nginx, apache, etc...)? Are these static sites, or are you using a content management system of some kind (e.g. Wordpress)?

If you're using Apache, this tutorial show put you on the right path:

Let us know how it goes!
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.