25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >

How to Install NGINX on cPanel

Posted on by Mohammed Noufal
Reading Time: 4 minutes

Installing NGINX on your cPanel server allows your webserver to increase server security, server performance, load balancing, and cache content. Hence, NGINX translates into faster websites and better experiences for end users.


cPanel is designed to simplify the administration of websites, and it is the most popular Linux-based graphical interface (GUI) web hosting control panel among web developers and hosting companies.

cPanel is typically paired with WHM (Web Host Manager) with each playing separate roles. WHM provides administrative control over the server. Apart from this, WHM helps to configure your server, creates multiple accounts, and manages more than one website. cPanel helps to publish your websites, manage domains, organize web files, create email accounts, etc.

To access your cPanel dashboard, use any of the following URLs, replacing yoursite with your domain name.

http://www.yoursite.com:2082 (If your website’s URL starts with http)

https://www.yoursite.com:2083 (If your site’s URL starts with https)


NGINX is an open source web server software used as a drop-in replacement for Apache Web Server. It is a high‑performance, highly scalable, highly available web server designed for maximum server performance and stability. Its main usage is:

  • Reverse proxying.
  • Caching.
  • Web serving.
  • A load balancer for HTTP, TCP, and UDP servers.
  • A proxy server for email (IMAP, POP3, and SMTP).
  • Web accelerator (it is a combination of an HTTP load balancer and content cache the features).
  • Media streaming.

NGINX can handle multiple client requests at the same time with minimum hardware resources, offering low memory usage with high compatibility. It also handles multiple requests in a single thread without creating new processes for each request. It can run 1,000 connections of static content concurrently two times faster than an Apache web server with less memory usage. Ngnix also helps transform dynamic content to static content.

Install NGINX on cPanel

Step 1: Install NGINX

To install NGINX on cPanel, you can use any of the following methods:

  • Using WHM’s NGINX Manager interface by going to the Software section in WHM.
  • Using the EasyApache 4 interface within cPanel.
  • Running the below command on the command line as the root user.
yum install ea-nginx

The NGINX installation process will change the server’s Apache installation to use different ports, and NGINX will proxy all requests to Apache. The process will only change the Apache ports if the Apache configuration uses the default ports of 80 and 443. If we install NGINX, the installation process also installs the required ea-ruby27-mod_passenger Apache module for installing or creating Ruby applications in cPanel. 

NGINX Configuration Changes

The NGINX installation process makes several changes to the server. Particularly, the NGINX installation configures Apache to no longer act as the primary web server, so the installation creates proxies for Mailman (cPanel’s mailing list software) and AutoSSL (cPanel’s automatic SSL installer).


Caching will be enabled for the domains by default.

  • NGINX will create and use a cache of the web page for the caching-enabled domain, which can substantially increase performance for the websites.
  • NGINX will proxy the request to the backend web server if the cache has expired or turned off for the first request of a website.
  • The backend web server processes the request then passes the response to NGINX.
  • NGINX then serves the response to the client. 

NGINX will cache data on a per-user basis. The cache file is stored in the location 

/var/cache/ea-nginx/proxy/username where ‘username’ is your cPanel username. 

Step 2: Configuring NGINX

Here are some helpful configurations to further customize your NGINX installation.

Configuration Files

  • Default cPanel NGINX configuration file/etc/nginx/conf.d/ea-nginx.conf.
  • User configuration: If you want to customize every server block that a user owns, you can create your .conf file in the directory /etc/nginx/conf.d/users/username and create your .conf file in the directory /etc/nginx/conf.d/users/username/domainname/ to customize a specific server block for a specific domain.
  • Global configuration: You can add any global .conf files that you create in the /etc/nginx/conf.d/ directory. To adjust every server block on your server, you can create your .conf file in the /etc/nginx/conf.d/server-includes/ directory.
  • Apache configuration: The NGINX installation will change the Apache port to the first available port under 1024, and this will normally be port 81. The NGINX installation will also change the Apache SSL port to the first available port under 1024, and this will normally be port 444. The installation will also add the below details to the /etc/nginx/conf.d/ea-nginx.conf file.
        default 81;
  • Custom configurations: You will need to create and include the file that ends in .conf in the appropriate location if you want to customize the server blocks for NGINX. A server block is the same as that of the virtual host in Apache. Each server block includes the .conf files in the directory /etc/nginx/conf.d/server-includes/.
  • Cloudflare Configuration: If a domain is using Cloudflare, the NGINX installation will detect it and configure the system to work properly, and the system will save the Cloudflare configuration to the location /etc/nginx/conf.d/includes-optional/cloudflare.conf.

Log Files

  • NGINX will log traffic for both www subdomains and non-www subdomains to the same location. For example, it will log requests for www.domainname.com and domainname.com to the /var/log/nginx/domains/domainname.com file.
  • The Access logs saves to the location /var/log/nginx/access.log.
  • The SSL requests saves to the location /var/log/nginx/domains/domainname.com-ssl_log.
  • The Non-SSL requests saves to the location /var/log/nginx/domains/domainname.com.
  • The Bandwidth related logs saves to the location /var/log/nginx/domains/domainname.com-bytes_log.

NGINX will log traffic for SSL and non-SSL requests save to the same location (/var/log/nginx/domains/domainname.com).

Replace domainname.com with your domain name.

Configure a User

The system will integrate NGINX into your user and domain changes and will use the /usr/local/cpanel/scripts/ea-nginx script to make these changes. It will also create your .conf file in the location /etc/nginx/conf.d/users/username.conf where username is your cPanel username.

Configure an Application

To configure applications in cPanel & WHM version 90 and later, you can use the Application Manager option in the cPanel. You can find it under the Software section in cPanel. In previous versions of cPanel & WHM, you will need to run the /usr/local/cpanel/scripts/ea-nginx script to update your configuration and then restart the server to reflect the changes.

Step 3: Controlling NGINX Services


  • To stop, start, or restart Nginx on cPanel, use the /usr/local/cpanel/scripts/restartsrv_nginx script
  • You must use the below reload command to restart NGINX in CentOS 7 as it ensures a graceful restart, allowing NGINX to restart without killing processes and workers.
systemctl reload nginx.service

Uninstall NGINX

To uninstall NGINX on cPanel, either use the NGINX Manager option or run the below command via SSH. You can find the NGINX Manager option under the software section in your WHM.

yum erase ea-nginx


Using NGINX on cPanel is an easy way to replace Apache and add performance to your web server. Following these steps to install NGINX on cPanel adds this functionality to an already powerful control panel.
If you are looking to use NGINX on cPanel or wish to purchase a server to test it, you can contact us anytime. We can help you by providing suitable plans according to your business needs and goals. At Liquid Web, we offer Dedicated Servers and Managed VPS Hosting options for your next project.

About the Author: Mohammed Noufal

Mohammed Noufal has worked as a senior server administrator for 8+ years. He can be found on LinkedIn to know more or connect.

Latest Articles

PHP 7 vs PHP 8: A Comparison

Read Article

How to Create a Symbolic Link

Read Article

What Is A Private VPS Parent?

Read Article

Managed Hosting vs Unmanaged VPS Hosting

Read Article

Why Is Your IP Address Blocked?

Read Article