Arguably, one of the most requested and popular feature requests submitted for cPanel & WHM has been the addition of the NGINX web server as an alternative to Apache. We have good news for those of you that have been asking: NGINX is coming.
Note: as NGINX support on cPanel & WHM servers is still experimental, it will not be available in the WHM graphic user interface right away. Be advised that this is a representation of how the interface may appear in later versions.
Offering NGINX as an Apache alternative
cPanel has considered offering NGINX as an alternative to Apache for quite a long time. However, given the state of cPanel & WHM’s reliance on Apache at its very core, we determined that the process was too difficult to undertake at the time. We have spent significant time working toward de-coupling the product from relying on Apache. While our work is not yet complete, we have gotten far enough along that we were able to make some first steps toward integrating a different webserver.
NGINX for WordPress on cPanel
Our research showed that the primary use case for people requesting NGINX support was WordPress sites, so that is where we focused this minimum viable product. We chose PHP-FPM as the PHP handler, as it is the handler that WordPress recommends and is already supported by cPanel & WHM.
To take advantage of NGINX, you will need to enable PHP-FPM on all domains that serve PHP content.
NGINX is a free cPanel Release Experiment
NGINX does not completely replace Apache in this experimental release. cPanel & WHM still requires Apache for certain features (i.e., Mailman) to function correctly. In this iteration, Apache is moved to an alternate port as part of the installation of NGINX, and moved back to its previous state when NGINX is uninstalled.
Please also be forewarned, this is an EXPERIMENTAL release. As is the case with all EDGE and Experimental builds, we do not recommend running NGINX in a production environment unless the server administrator is very experienced, and has a rollback plan in place. There are going to be things that just don’t work within the product, which we expect. We will be looking for your feedback on anything that doesn’t seem to be working properly, and we’ll gladly iterate as time allows.
At this time we can say for sure that mod_security rules will not work with NGINX, and .htaccess rewrite rules and restrictions will no longer apply. Meaning such rewrites as password protected directories will no longer work.
The Good News!
Instead of focusing on the portions of cPanel & WHM that won’t currently work with NGINX, here are the portions that we’ve tested and have shown that work normally:
So… How Do I NGINX on cPanel?
The installation process is pretty straightforward but requires root-level SSH access to your server. Once you’ve accessed your server, run the following commands:
> yum install ea4-experimental
> yum install ea-nginx
NGINX does not hook into cPanel & WHM at all, so if any configuration changes are made, you’ll need to manually run
/scripts/ea-nginx config --all to regenerate the NGINX configurations and reload the server. Adding this script to your root crontab when utilizing NGINX is one potential solution for servers where frequent changes are made.
We need your feedback
We have decided to release this as experimental because we are fully aware that NGINX is not production ready for cPanel environment yet. Our goal is to gain feedback from you, the cPanel community, so we can gauge your wants and needs from NGINX as a feature, and build upon it for future iterations. As it stands right now, we are not planning to take NGINX into production as some important cPanel features do not currently function properly. Your feedback on NGINX will be extremely helpful in showing the value that it adds to the user base at large.
The answer to this is not a simple one. This release will help us gauge current interest in NGINX as an alternative to Apache, and help us get valuable feedback from the community. However, we don’t yet have a timeline for taking this implementation from experimental to production. Once we see the adoption of this experimental implementation and gain feedback from those users, the next step is correcting the problems that we know of. We then put the product through a rigorous testing period, ensuring no critical or major bugs are introduced, and that the feature meets our criteria for a production level feature. Only then will we begin to introduce it into the production environment.
Update July 2019: We’ve made NGINX even better!
There are a few new add-ons to NGINX that make it more viable, although it’s still experimental for now. You can read about our NGINX improvements at our blog post NGINX Levels Up.