Multiple sites on a single droplet: Apache + nginx

October 20, 2013 8k views
Looking for best practices to running multiple sites from a single droplet. I’ve followed instruction to setup a standard LAMP stack but have been suggested to use nginx for managing virtual hosts; which is causing problems with apache running. Should I use both Apache and nginx? If just nginx, how does that work with a LAMP stack? What should I do to disable Apache sites-available and sites-enabled?
6 Answers
You should use either Apache OR Nginx, using both at the same time can become a headache, while it can be done.

Watch these tutorials for more info, they should be a help.
Installing LAMP:
Setting up your domain name:
Setting up Apache:

If you have any questions, just reply!
Forgot to mention, those links I gave you were for setting up Apache. If you want a Nginx install tutorial, I suggest for you to watch these two:,

Again, if you have any questions, just reply!
I’ve had folks suggest I use nginx based upon performance; I’ve previously run a simple LAMP stack with apps like WordPress in the past, if I’m moving from a managed server to a VPS for the first time, what makes the most long-term sense?

In other words, what reasons should I look to run Apache instead of nginx (which seems to be what most of my peers are recommending)?

Honestly, in all aspects, I would go with Nginx. Here's the deal, if you have an Apache service you risk getting a Slowloris attack, but with a properly configured server, that shouldn't be an issue. Apache has been around since about the start of the web, so people usually go with it. The positives of using Nginx is that it uses less memory than that of Apache. "Nginx is about 50 times faster than Apache" - from the people at wikivs -
Sticking with Apache for WordPress sites is like sticking with a horse 'n buggy when cars were invented.

Dump the LAMP stack and go with the LEMP stack, instead. Here's a very good (i.e., blazing fast) WordPress set-up: How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04.

In re: to hosting multiple sites on one droplet, How To Set Up Multiple WordPress Sites on a Single Ubuntu VPS. However, instead of Apache virtual hosts, use How To Set Up nginx Server Blocks (Virtual Hosts) on Ubuntu 12.04 LTS, instead.
by Etel Sverdlov
This tutorial shows you how to set up a new directory, how to grant the correct permissions, how to add content to a new page, how to turn on virtual hosting, and how to, if needed, set up local hosts. Virtual Hosts are used to run more than one website or domain off of a single server and IP address. When used with nginx, virtual hosts are called Server Blocks. This tutorial covers setting up server blocks on an Ubuntu server.
+1 for nginx. Its FAST, way faster than my last setup and thats without even using Varnish. Varnish is great but requires a bit more work. If you are not that experienced with VPS, nginx is as much work as Apache and much quicker with less resources required. The how to articles listed above and any others in the Articles and Tutorials section on LEMP are all you need to get started.

FWIW I am running 6 low traffic sites WP sites and 2 Magento sites off a single LEMP VPS and its still only at 50% capacity. Its more work than shared hosting but the performance gains and cost savings are worth it.
Have another answer? Share your knowledge.