Why nginx is WordPress Hosting’s Best Friend

By WP Saviour •  Updated: 04/16/21 •  9 min read

In my earlier article I explored why PHP7 is the best way to go for WordPress and in as we speak’s article it’s the webserver’s flip.

An enormous a part of internet hosting expertise is how the webserver stack is configured. Having a quick stack is paramount to good WordPress efficiency & an excellent person expertise. I’ve already mentioned why PHP7 is such a great way to routinely enhance WordPress efficiency however what concerning the precise webserver?

Right this moment I’m going to clarify: what’s a webserver, what are the preferred ones and why nginx is so rattling good!

The Webserver

One of the vital elements of internet hosting is the precise webserver. The webserver is chargeable for offering static content material akin to HTML and sending it to the shopper (which implies, proper into your browser). So the webserver may also be accountable for processing all the data that comes by way of the PHP processor and changing it to bits that journey by means of the community into your browser. The webserver stack works with the shopper / server mannequin the place the webserver is performing as a server (supplier of content material) and the shopper (you) the one which request it.

The commonest webservers are Apache, IIS from Microsoft and naturally nginx.

The webserver is ready to deal with each static & dynamic content material that’s despatched to the shopper with some barely variations. The server half hundreds into reminiscence in what is known as a employee course of and it’s accountable of offering the content material requested. Each Apache & nginx deal with static and dynamic content material. Whereas Apache is ready to deal with each inside the identical employee course of, nginx doesn’t because it wants an exterior processor to do it.

Why are Apache and nginx so well-liked? The easy reply is as a result of they’re Open Supply and free. Collectively they make up virtually 50% of all of the site visitors on this planet, not a simple feat!

What’s Apache?

The Apache HTTP server was created by Robert McCool in 1995 and it’s nonetheless underneath growth underneath The Apache Software program Basis. This webserver has been the preferred alternative since 1996. It’s very modular in design, has tons of documentation and it’s so well-liked that it’s the premise for all the main Internet Internet hosting Management Panels. It’s even included in cPanel, probably the most used management panel on this planet.

After all it’s versatile, that’s the excuse that the overwhelming majority of individuals utilizing it’s going to provide you with when requested and customarily, that’s true. It is usually very extensible and since it could actually load modules dynamically (one thing nginx continues to be engaged on) it may be configured with ease.

Apache is ready to deal with static and dynamic content material all by itself in the identical employee so it’s excellent for it’s flexibility however (and there’s at all times a however) it does so on the expense of efficiency.

Apache has been recognized for being considerably gradual however nothing got here near exposing this fact as when nginx turned well-liked. The efficiency distinction between them is one thing that can’t be neglected. For this matter alone, most main corporations are switching over to nginx. Regardless that Apache continues to be well-liked, issues will certainly change sooner or later as expertise catches up and increasingly more software program that had been beforehand working solely on apache begin to embrace nginx.

What About Nginx?

Nginx comes from mom Russia. In 2002 a programmer named Igor Sysoev started engaged on nginx as he was profoundly involved concerning the C10Okay downside. The what? To place it merely, optimizing community sockets to deal with numerous purchasers on the similar time which was Apache’s essential downside and an actual problem for the trendy internet. The preliminary nginx launch was made public in 2004 primarily based on an events-driven structure.

Not even Sysoev himself might see how a lot success nginx would have. The large advantages of pace underneath nginx and the low useful resource utilization turned evident as time handed. Nginx has an impressive manner of offering with static content material however can not deal with dynamic content material. This additionally proved to be a profit as a result of the dynamic content material wasn’t sure to the identical employee and thus, might work a lot quicker.

Nginx excels at offering quicker content material to a a lot larger quantity of connections than Apache and is presently the selection for internet hosting providers that need to provide the perfect efficiency attainable. It’s event-driven structure and it’s asynchronous nature are the details for it’s efficiency.


Initially nginx had one essential downside, it’s documentation. It had a tough begin because of the programmer being Russian and the best way he documented it’s capabilities. However as time has handed and increasingly more individuals use nginx the documentation has improved immensely.

The opposite downside of nginx it’s in it’s lack of modular design which implies it can not course of guidelines in realtime like Apache does with it’s .htaccess file and can not load modules in realtime both. That is one thing that nginx is already engaged on however will nonetheless want time to match Apache’s flexibility.

The drawbacks however are shortly overshadow by the excellent efficiency. This in itself has allowed nginx to turn out to be the favored alternative for efficiency oriented internet hosting and it’s the premise for service as extensively used as Steam, proving time and time once more that it could actually persistently rating larger than Apache in each manner.

Why is Nginx the Most well-liked Alternative for WordPress Internet hosting?

There are a number of factors by which nginx is much better than Apache for internet hosting WordPress websites. I’ll attempt to summarize this into the next record.

Simple to Set up

Nginx is a whole bundle, it requires only a few exterior modules to work and the overwhelming majority of the time, it solely takes one line in linux to allow it.

apt-get set up nginx

yum set up nginx

It’s all it takes for nginx to be lively as a service. The remainder is within the configuration.

Can work as a proxy for Apache or every other webserver

Nginx can present an on the spot efficiency enhance to any Apache webserver configuration by working as a proxy with out affecting the performance of the server in any manner.

Can work immediately with a microcache and even fastcgi cache

Nginx is nice because of it’s inbuilt microcache and may even work with an fastcgi cache to hurry up efficiency by an element of 10. Nginx also can present an amazing enhance in efficiency when working with a fastcgi cache and received’t even want an exterior caching mechanism akin to memcache.

It’s extremely quick for serving content material

Nginx is lighting quick when coping with static content material and it’s very straightforward to configure for such functions. A single line of code can allow entry the commonest recordsdata akin to static content material and enhance it’s efficiency. Plus, if you understand how to configure HttpProxyModule you may even obtain the identical stage of efficiency for Dynamic content material with out affecting the performance of the webserver.

Nearly four instances extra concurrent connections than Apache

When you’re contemplating internet hosting a really excessive demand web site with tons of 1000’s of visits per day it will be good so that you can know that nginx can course of as a lot as 4 instances the quantity of concurrent connections as Apache, which implies 2 issues:

That is because of the event-driven nature of nginx and it’s reponsible for the following profit.


Very Light-weight

Nginx is so effectively crafted that it’s unbelievable light-weight on sources. This implies it’s going to use much less CPU time to course of every connection request and can achieve this utilizing so much much less reminiscence. This can assist you to host larger websites utilizing the identical server that had been beforehand unable to take action in Apache.

The key of it’s success is within the engine itself. Nginx works as an occasion triggered webserver which implies it’s going to hear “occasions” on the employee and can reply solely when wanted. The ondemand argument inside nginx permits the service to spawn and take away listeners on demand. This helps cut back reminiscence utilization and enhance effectivity. Apache tried to incorporate an occasion mode within the mpm-event employee but it surely failed miserably in matching nginx pace as a result of Apache wasn’t constructed as an event-driven webserver.

It may well do Load Stability

Nginx will be configured for load steadiness, therefore, growing it’s charge of concurrent connections much more by spreading the load between a number of servers making it superb for tasks which have a really excessive load of concurrent connections.

What Does This All Imply?

It implies that nginx is superb for WordPress in virtually each manner. It implies that you’ll reap the advantages of utilizing it virtually instantly after implementation. In case you are a system administrator, putting in nginx is a no-brainier. If quite the opposite you need to design a venture or host your web site and need to host it elsewhere, chances are high actually excessive that in case your internet hosting use nginx, it’s going to work quicker.

Top quality internet hosting corporations akin to WP Engine and Flywheel already run on nginx. However for those who’re going to go along with a special internet hosting firm, do your analysis or ask a help tech if the webserver stack consists of nginx. I can assure you that if the service is a high quality one it’s going to have nginx included in some a part of the stack.

WP Saviour

I am a WordPress specialist. My mission is to help you create beautiful websites with ease!