Open source · Servers

Apache or nginx?

Chris Leggitt Software Engineer at NextGenInc

October 10th, 2016

These two are the most common open source web servers. Each of them has its pros and cons. I would like to know which one is your choice and why?

Stephen Packer Lead Developer at Lettuce Box LLC

October 11th, 2016

Caddy. It's performant like Nginx, HTTPS by default and auto-generates SSL certificates for free using LetsEncrypt, and easy to configure.

Garet Claborn CEO, Original Author at Approach Corporation

October 10th, 2016

NGINX.

Not to say there aren't viable configurations for Apache, like MPM, and other candidates for server software. When it comes to PHP, nginx with PHP FPM (which is now built in) is very fast.

Personally I believe that tales of balanced "pros and cons" are almost entirely synthetic. Apache, in the hands of a very experienced admin, can do well at threading but even at it's best is a resource hog.

PRO-Apache:

1. Deeper configuration scripting options for less common networks, caching scenarios and services.

2. More tutorials online. Familiar, respected.

PRO-NGINX:

1. Very clean architecture, fewer things can go wrong once you've got it right.

2. Massively threaded. 

3. Lightweight memory footprint and processor usage

4. Far above apache in serving static content

5. Can use the more common apache configurations and has some unique abilities. 

6. Modern concerns taken into account during design of NGINX 


ANTI-Apache:

1. Bloated. SO SO bloated. Do not underestimate the level of resource drain that is caused in the majority case. Experienced admins may fine tune it but there's only so much you can really do. You need more CPU and more RAM to run the same site at the same traffic level.

2. Complex. While more people are used to Apache due to its age and near monopoly early on, the average admin of those I've met are not masters of it. There are many nuances to any web server, but especially Apache imho.

3. Apache's detailed config scripts are both a pro and a con. You don't want to have to debug a configuration. While things like "EasyApache" exist, most scripted installs are not optimized for your situation.

4. Declining support, industry slowly moving on.Even Apache 2 is based on partially outdated code.

5. Totally subjective, but Apache was once my favored server. I can hardly stand to use it anymore, I feel that NGINX has spoiled me.


ANTI-NGINX:

1. Slightly less community support / tutorials online. Not in short supply by any means, though.

2. If you are accustomed to Apache already, you'll have to learn a little bit.

3. Some of the NGINX nuances are annoying, like sockets sometimes need. a little help depending on which distro you use. Nothing major.

4. NGINX Pro. AFAIK Apache is 100% open source. NGINX is trying to monetize the product directly, which means some good features may be withheld from the base offering. It seems this mostly relates to cloud clustering however which neither do out of the box anyway.


Andrea Raimondi Computer Software Consultant and Contractor

October 10th, 2016

What are you trying to do?

Tim Boudreau Consulting Product Manager / Software Engineer at Oracle Labs

October 10th, 2016

NginX, without question.  Unless you need some Apache-specific feature, Apache's process-oriented design is very dated and inefficient, and, because of its design and the need for backward compatibility, unable to take full advantage of asynchronous I/O features in modern operating systems.  Apache was designed for a different era, when web applications ran inside the web server itself and were likely to be Perl scripts.

The one case I can think of for using Apache in this day and age is if you're using PHP - and if you are, then the efficiency of your web server is the least of your problems.

Rob Mitchell Senior Java Software Engineer at Direct Commerce

October 10th, 2016

I've used Apache most of my life, but recently started looking at nginx and I am very impressed. And I certainly love the idea of embedding the server into my Java app which seems much more trivial these days and tends to gain a lot of flexibility for very little effort. Just my opinion. 

Sebastien Mirolo CEO DjaoDjin inc.

October 10th, 2016

nginx always. Maybe Apache if you are trying to deploy a PHP site.

Pankaj Agarwal

March 3rd, 2017

Nginx is like a swiss army knife tool and can be very helpful at times. Nginx Plus now has WAF capabilities as well. Also, it can serve many more connections then Apache on performance perspective with much less resources.