Performance boost your cPanel websites: Using NGINX reverse proxy with caching

CPanel/WHM is web hosting Control Panel software developed by cPanel, LLC. It is one of the most popular offerings provided by web hosting companies. It enables website owners to easily and efficiently manage their websites using a feature-rich and web-based interface working from a single dashboard.

cPanel uses the Apache HTTP Server as the webserver by default. Similar to cPanel, Apache HTTP Server is also the most widely used and popular web server. Consequently, it is also a powerful and flexible HTTP/1.1/2 compliant web server having support for a wide range of modules, which is the reason for its use in the cPanel appliance.

But Apache HTTP Server is a process-driven appliance that creates a thread upon each new request from a website visitor. This means that the web server uses up more and more resources with the increased number of website visitors. This could serve as the source of a high-resource utilization issue when the server is experiencing heavy traffic.
Meanwhile, we have the Nginx webserver that is gaining in popularity and chosen by many web hosting companies as an alternative to Apache HTTP Server. This is because Nginx has an event-driven architecture that can handle multiple requests within a single thread, allowing it to work with a small memory footprint. This quality of Nginx provides resource efficiency and responsiveness even under heavy traffic conditions.

There are ways to replace Apache HTTP Server with Nginx in the cPanel appliance.

But then we will miss the versatility and compatibility of Apache HTTP Server that is looked up to by many of the customer websites out there.

So, in this scenario, instead of choosing either of the web servers, we can deploy Nginx as a Reverse Proxy for the Apache HTTP Server, which will utilize the features of both web servers. It brings us the best things from both worlds.

As a Reverse Proxy server, Nginx will stand as a front-end server – forwarding all requests to the Apache HTTP Server, which then serves as a back-end server processing all the website requests.

Additionally, Nginx can also act as a cache for Apache HTTP Server. When used as a caching appliance, Nginx caches dynamic content for Apache HTTP Server and responds directly to future requests for the same content. Thus, using Nginx with cPanel as a Reverse Proxy with caching can substantially increase the stability, availability, and overall performance of the server.

The following steps will explain how to install Nginx Reverse Proxy with caching on a server that runs cPanel/WHM.

In our WHM Control Panel, go to SoftwareNginx® Manager.

Click Install to deploy the Nginx web server as a Reverse Proxy.

When cPanel performs this installation, it will also install any other packages that are required for this feature to function.


Once the installation is completed, we may access the Nginx settings in our same WHM Control Panel, at SoftwareNginx® Manager.

We can see that the option Use caching by default is Enabled by default.
It allows us to enable or disable Nginx caching globally and also on a per-user basis.

Nginx caches data on a per-user basis. The cache files are stored in the directory path /var/cache/ea-nginx/

For most websites, a great amount of content does not change daily or even monthly. Any time a user visits a website it will request the same resources, and the web server will process the request and provide content to that user regardless of whether the content was modified or not.

For a really busy website, this can result in a lot of unnecessary requests if the same user accesses the website regularly. Foremost, this is really not an efficient use of resources. And there is a financial downside to this behaviour that can incur additional costs since we will need to add more and more resources to deal with the increasing load.

Caches can dramatically reduce the cost of web hosting and thus improve the user experience for web browsers or mobile apps. Pre-processing the content and storing it in the server’s memory or storage, and serving that content to repeated visitors asking for the same content can help drastically reduce the server load.
In addition, we can also add the following features to enhance the Nginx Reverse Proxy.

Enable brotli compression.

yum install ea-nginx-brotli


Brotli is a lossless data compression algorithm developed by Google. It uses a combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding and 2nd-order context modelling. Brotli is primarily used by web servers and content delivery networks to compress HTTP content, making websites load faster. It is considered as a successor to gzip.

Enable gzip compression.

yum install ea-nginx-gzip


gzip is a lossless data compression based on the Deflate algorithm, which is a combination of LZ77 and Huffman coding.

Enable compression for njs.

yum install ea-nginx-njs


njs is a subset of the JavaScript language that allows extending Nginx functionality.

Enable HTTP/2 support on SSL requests.

yum install ea-nginx-http2


HTTP/2 is a major revision of the HTTP network protocol used by the World Wide Web. It was derived from the earlier experimental SPDY protocol, originally developed by Google.

If we are wondering whether Nginx as a Reverse Proxy with caching is the right choice for our servers, the answer is almost certainly yes. It takes seconds to deploy, and it will significantly improve performance while reducing server load.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top