Can or should I install multiple sites on one droplet?

July 31, 2014 4.3k views

Hi,

I was wondering could a single droplet support multiple sites? What is the best practice here?

  • If so how can I setup the dns?
  • Should I be looking at Nginx over apache?
  • I have no Nginx experience but the idea is to use my droplets as a testing ground to ultimately deploy Laravel sites.

Thanks,

1 Answer

I was wondering could a single droplet support multiple sites?

Definitely! You can host as many sites as you want on a single droplet.

If so how can I setup the dns?

Simply point all of your domains/subdomains to your droplet's IP address. Your webserver will take care of the rest.

Should I be looking at Nginx over apache?

It doesn't matter -- you can use whichever you prefer :)

I have no Nginx experience but the idea is to use my droplets as a testing ground to ultimately deploy Laravel sites.

See How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS. You'll need to create a VirtualHost for each separate Laravel app you want to deploy.

Then, upload your Laravel app to /var/www/domain.com/public_html, and update DocumentRoot in your VirtualHost config to point to /var/www/domain.com/public_html/public.

Finally, you'll need to allow Laravel to write to /var/www/domain.com/public_html/storage. You can do that by executing the folllowing commands:

sudo chgrp -R www-data /var/www/domain.com/public_html/storage
sudo chmod -R g+w www-data /var/www/domain.com/public_html/storage

Repeat that for every Laravel app you want to host.

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.