Tips / Nginx

Apache Vs Nginx

Apache vs Nginx, two sides of one coin with very significant differences. Today we will try to bring light to this eternal battle by answering a few questions: What are the key differences between both? Are both good for all markets? What web server should I choose in the end?

Main features supported by both Apache and Nginx

  • Access controls
  • URL rewriting
  • Custom logging
  • Server-side includes
  • Limited WebDAV
  • FLV streaming
  • FastCGI
  • Static file serving
  • SSL/TLS support
  • Virtual hosts
  • Reverse proxying
  • Compression

Exploring the key differences between Apache & Nginx


Apache is a process-based server, while on the other hand, Nginx is an event-based web server. This means Nginx doesn’t need to spawn new processes or threads for each request that is made, resulting in less memory usage than Apache.  Years ago, when started using Nginx, they found it to be the only load balancer that was capable of handling 8,000 live traffic requests/sec without becoming a resource hog. That’s one of the reasons they still use it, las well as other companies like Yahoo, Cloudflare, Dropbox, Github, Netflix, Instagram and other global companies.

Performance & Speed

Both servers are capable of serving a huge number of requests per second, but Apache’s performance starts decreasing as you add more concurrent connections. Here Nginx performance doesn’t feel any pain at all. Nginx performance and speed, in general terms, overcomes Apache by 2x to 3x times for any simple PHP-based website.

Another design difference between both is that Nginx doesn’t support .htaccess files for the simple fact that .htaccess files are a resource hog. If you have AllowOverride at all in your Apache configuration (enabled by default), you are telling your Apache server to search in all the directories of your document root to see if there are .htaccess files and then execute the instructions placed inside. For this reason, Nginx rewrite rules are built into the core of the Nginx configuration, giving you an exact place to look into and of course faster application performance.

For lazy developers, Apache is fine with its .htaccess structure. However, for developers who really value web performance & security, Nginx is the perfect choice.

Community & Commercial Support

The Apache community has been around since the late 90’s. It has very extended community around the globe.

Nginx was born in 2002, but being a young warrior doesn’t mean it lacks support or documentation. In fact, in the past years, the Nginx community has been growing a lot. More and more blogs, user communities, and companies are evangelizing Nginx ( for example) and acknowledging how it’s changing the world of web performance.

If you find yourself as a newbie in the Nginx world, you can get commercial support from, the original developers of the product. Apache hasn’t offered any commercial support since its beginning.

Built for modern developers

Nginx is the next standard stack for the modern developer: LEMP (linux, nginx, mysql, php/python) is becoming a new dev stack for the masses. Developers love the way Nginx brings results, as well as high performance speeds, proxy and load balancing features.

Do you know any of the new era developers that are using Apache to serve NodeJS or Python apps? We don’t.


While both web servers receive  updates, Nginx is investing a lot of time and money into building new things for emerging and trending technologies. For example, we were surprised to find out that now Nginx supports new TCP balancing methods like MySQL with Galera Cluster.

It’s been a while since news has come from Apache, even though they introduced a lot of cool features in version 2.4.  Still, we don’t feel they are fast enough to offer real life solutions for most modern web applications and development trends.


On most modern Linux distributions, this is the case: 1) Apache as web server and PHP as mod_php, a module loaded into Apache that depends 100% of it in order to parse PHP scripts; 2) For Nginx, if you want to parse PHP files, you must install a second and 100% independent component. The most popular is PHP-FPM. This is different than mod_php because it’s a particular system daemon that runs its own process and handles its own requests. This means that you can split your Nginx and PHP parsing process between multiple servers, which allows for incredible scaling capabilities.

Who’s the winner in this Apache vs Nginx challenge?

Not everybody in the server & hosting industry is 100% up to date regarding the support of Nginx on their platforms. For example, cPanel (one of the leading control panels in the hosting market) hasn’t been able to fully integrate Nginx as a native http server. They are still using Apache. So, if you are running a shared web hosting company, you may want to keep using Apache 2.4.

However, in cases when you don’t actually need a cPanel control panel, you can work directly with your O.S & Nginx. Doing this will give you a tremendous boost in your speed and server performance.

From MaxCDN’s point of view and extensive testing on its CDN platform, Nginx is the best solution for all kinds of content. Even Apache version 2.4 can’t compete with Nginx in terms of memory & cpu usage, load balancing capabilities, and integration with emerging developement technologies.

How about you? What’s your favourite web server? Let us know in the comments below.

Popular search terms:

  • nginx vs cpanel
  • apache vs nginx
  • how nginx overcome htaccess
  • nginx webdav speed

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking