Apache vs. nginx: Tips on Going With LAMP or LEMP

Adnan Raja
by (131 posts) under Technology
  • Components of LAMP & LEMP
  • Apache or Nginx?
  • Pluses and Minuses
  • A Final Decision
  • One-Click LAMP & LEMP

Components of 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.

A LAMP stack is made up of four pieces of software:

  • the Linux operating system
  • Apache Web server
  • MySQL as the relational database management system
  • either Perl, Python, or PHP as the scripting language

Just as people tend to differ on their choice of scripting language, many prefer an increasingly popular Web server alternative: Nginx. When Nginx is used, LAMP becomes LEMP.

Let’s explore these two very similar options.

Apache or Nginx?

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 (pronounced “engine-x”) 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 hosting service. At Atlantic.Net, we are developer-friendly, with LAMP Cloud Hosting and one-click cloud LEMP stacks that feature:

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

Related Posts

Stay Connected With Us