Atlantic.Net Blog

LAMP vs. LEMP – tips on choosing Apache or nginx for your web server

  • LAMP vs. LEMP – what’s the difference?
  • Apache (LAMP) or nginx (LEMP)?
  • Pluses and Minuses
  • A Final Decision
  • One-Click LAMP & LEMP

One of the most popular environments for Web development is the classic LAMP stack. According to Webopedia, LAMP is an idea that originated with German tech writer Michael Kunze in 1998.

LAMP vs. LEMP – what’s the difference?

A LAMP or LEMP stack for a web server is made up of four pieces of software:

  • L – the Linux operating system
  • A/E – Apache or nginx Web Server
  • M – MySQL as the relational database management system
  • P – either Perl, Python, or PHP as the scripting language

When nginx is used instead of Apache, the LAMP stack becomes a LEMP stack – the “E” refers to the implied “E” in the word “engine,” as nginx is pronounced “engine-x.”

Apache (LAMP) or nginx (LEMP)?

As of May 2014, these were the Netcraft statistics for Web server developers:

  • Apache – 38%
  • Microsoft – 33%
  • nginx – 15%
  • Google – 2%

Keep in mind that Apache’s market share has been as high as 70% – which was in 2005, when nginx was three years old but right around 0% adoption. As the latter Web server has been increasingly adopted and Apache has lost a substantial amount of users, it’s easy for coders to think that nginx is the obvious best choice, explains software engineer Matthew Mombrea of ITworld.

“Nginx has become popular due to its event-driven design which can make better use of today’s computer hardware than Apache’s process driven design,” he says. “The end result is that nginx can serve more concurrent clients with higher throughput than Apache on the same hardware.”

However, Mombrea stresses, that is only true some of the time.

Pluses and Minuses

One fact of the matter is that nginx is more efficient at serving static content than Apache is. However, that’s not enough to make your decision.

Think about how the server will be used. If the server is for one site, and it’s a dedicated Web server that you are using alongside a database server, Nginx will give you better performance for large amounts of traffic. Scalability is more user-friendly as well.

Things can get fuzzy, though, when you are using the server to host multiple sites, says Mombrea. “In that case, PHP becomes much more of a bottleneck than either of the web server choices,” he notes.

Beyond PHP creating performance parity if you have a bunch of sites running, there are also specific reasons to choose Apache. When you go with the older, more mature Web server, you will find that its features are usable immediately, while you will often have to look up how to reconfigure nginx. Similarly, there are reliable options for automated setup tools and user interfaces. Typically IT people are used to working with Apache and can better troubleshoot it. It has a web of technological and social support, in other words.

In most cases, you won’t see much difference between the speed of the two Web servers. Think about what you really need and whether you want to take on the challenges of working with a less widely recognized one.

You should feel more confident if you’re using nginx first in a testing environment, such as your personal blog, notes Mombrea. “If you’re setting up a cloud hosting server or a critical business application, weigh your options carefully,” he says. “Trying to force everything into nginx because you heard it will be drastically faster could be a mistake.”

The Web server is not the end-all and be-all of your performance of course. For large sites, it’s a small piece of their architecture. For small-to-medium sites, consider your true needs along with your degree of familiarity. There is a reason that Apache is still the most prevalent server right now, as delineated above. As nginx matures and more IT staff understand it, it may well overtake the top position.

A Final Decision

Not everyone thinks this choice is difficult. Sukoon Shete, commenting on Quora, is one example. “Apache is like Microsoft Word, it has a million options but you only need six,” he says. “Nginx does those six things, and it does five of them 50 times faster than Apache.”

Mombrea doesn’t think the decision is quite that easy though. You have to look at the specific hosting scenario, he says. For WordPress, they’ll both be fine. If you smartly cache your site, you will get better performance with nginx. However, you won’t have the immediate compatibility and broad user-friendliness of Apache. For PHP applications, get APC or a similar opcode cache to speed things up rather than switching out Web servers.

One-Click LAMP & LEMP

If you want strong performance and reliability, LEMP won’t solve all your problems. You also need a strong VPS hosting service. At Atlantic.Net, we are developer-friendly, with one-click LAMP and LEMP stacks that feature:

  • 100% ultra-fast pure SSD drives;
  • Deployment in 30 seconds; and
  • 24/7 technical support

For more interesting articles and helpful how-to’s on LAMP and LEMP, make sure you check out our blog.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year