
Nginx is an open-source, efficient, and free web server. Nginx is famous as a Load Balancer, Web Server, and HTTP Cache. So, if you need to Configure Nginx on WHM/Cpanel, this tutorial will be of great help to you. Also, the installation process is easy and fast.
Remarkable Points Before Installation
If you install and configure Nginx on your WHM, it will help you to perform actions such as installation, removal, and changes with reverse proxy. If Nginx is not installed on your system, the administration entry page allows you to install this web server on the Cpanel server by clicking the Nginx button, but, if it is preinstalled, the default interface is placed in the system settings tab. Finally, if the server has already installed an Nginx-Standalone package, it will ask for the installation interface of Nginx with the reverse proxy cache. For this reason, click on the switch to Nginx reverse proxy mode and the package will be installed.

Installing Nginx on WHM
Before starting the Nginx installation process, we suggest that you choose the plan you need from among the Linux VPS plans provided in NeuronVM.
You can install Nginx on Cpanel using 3 different ways:
_ The first method is to use the easyApache 4 interface in Cpanel.
_ The second one is to use the WHM manager interface by going to the software part in WHM
_ And the last method is to run the bellow command on the command line as the root user:
yum install ea-nginx
The most user-friendly method is to install the Nginx manager on WHM. Now, click on the install button and you will see a new interface appears. Then WHM installs the Nginx web server on your system. This way all Cpanel accounts will be configured to use Nginx and cache feature by default.
After the installation is done, you will see an option with the content “Go to Nginx manager“. Now you can click on it to return to the interface. You should then open the system setting tab.

Configure Nginx on WHM/Cpanel
Configure Nginx on WHM
Here we will analyze the way of configuring Nginx. So follow the rest of the article carefully.
Configuration changes on Nginx
The Nginx installation process, changes the Apache server installation, to use different ports. Then Nginx will proxy all requests to Apache. The Apache ports will only change if the Apache configuration uses the default ports (80, 443).
By installing Nginx, this process will also install the Apache module ea-ruby27-mod_passenger to install and create a Ruby application on Cpanel.
Main Configuration for Nginx
You can use the command below for the default Nginx configuration file:
/etc/nginx/conf.d/ea-nginx.conf
Then for user configuration and customizing every server that the user owns then create your own .conf file in the directory:
/etc/nginx/conf.d/users/username
Customize a specific server block for a specific domain and create your .conf file in this directory:
/etc/nginx/conf.d/users/username/domainname/
To add global configuration, go to the following directory:
/etc/nginx/conf.d/
And to set every server block on your server, create your .conf file in the directory below:
/etc/nginx/conf.d/server-includes/
Configuration for Apache
If you install Nginx, it will change the Apache port to the first available port under 1024. this will be port 81. Also, Nginx installation will change Apache SSL to the first available port 1024 which is 444.
At last, this installation will add the details below to the directory /etc/nginx/conf.d/ea-nginx.conf.
map $host $CPANEL_APACHE_PROXY_IP {
default 127.0.0.1;
}
map $host $CPANEL_APACHE_PROXY_PORT {
default 81;
}
If you want to customize the server blocks for Nginx, you should create the .conf file in the appropriate location. The server block is the same as the virtual host in Apache, and each block includes .conf file in /etc/nginx/conf.d/server-includes/ directory.
In Cloudflare configuration, Nginx installation will detect when a domain is using Cloudflare. Then it will configure the system to work properly and the location in which the Cloudflare configuration will be saved is /etc/nginx/conf.d/includes-optional/cloudflare.conf.
Conclusion
With this article, you can now configure Nginx on WHM/Cpanel. It is really easy to use as you can use Nginx Manager and control Nginx on the Cpanel web server just by using only a couple of clicks. If you have any other ideas, please share by leaving a comment.
FAQ
To use Nginx with Cpanel you should manually install it with Apache on the Cpanel server but the easier way is Engintron.
– 8 Gb RAM
– 8-core CPU @ 2.40 GHz or similar