Last modified: 2025 February 10
Overview
- This document refers to NGINX® functionality when you install the
ea-nginx
package in either WHM’s NGINX Manager interface (WHM » Home » Software » NGINX Manager) or WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4). This package is our production version of NGINX. For information about our previous, experimental version of NGINX, now ourea-nginx-standalone
package, read our NGINX Standalone documentation. - This feature is not currently compatible with the LiteSpeed Web Server.
This document explains how to install NGINX, an open source web server that also provides a reverse proxy, load balancing, and caching, on a server that runs cPanel & WHM and EasyApache 4.
cPanel & WHM’s NGINX with reverse proxy passes dynamic content through a proxy to Apache®. This version of NGINX uses caching in order to serve content more quickly.
Stop or restart NGINX
To stop or restart NGINX, use the /usr/local/cpanel/scripts/restartsrv_nginx
script.
nginx
command to stop or restart NGINX. If you do, you will have to troubleshoot to fix resultant problems.
We strongly recommend that you only use the cPanel script or WHM’s Service Manager interface (WHM » Home » Service Configuration » Service Manager) to restart NGINX.
For more information, read our How to Restart Services documentation.
Configure a user
The system integrates NGINX into your user and domain changes.
The system uses the /usr/local/cpanel/scripts/ea-nginx script
to make these changes. You do not need to run this script.
The system creates the .conf
file in the following location, where username
represents the username:
/etc/nginx/conf.d/users/username.conf
Configure an application
Use cPanel’s Application Manager interface (Home » cPanel » Software » Application Manager) to configure applications.
NGINX-specific packages
We provide some additional packages that you can use with NGINX. These packages provide functionality that may otherwise be missing in the installation.
Compression
We provide the gzip and Brotli packages to enable compression on NGINX. If you install one of these packages, it will enable that compression globally.
If you use compression with SSL/TLS requests, your compressed responses may be vulnerable to BREACH attacks. To lower the risk of this type of attack, you can perform one of the following actions:
- Do not send sensitive data in your HTTP responses.
- Limit your responses to only use secure samesite cookies.
Brotli
To use Brotli, install the ea-nginx-brotli
package in the Additional Packages section of WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).
You can use the /etc/nginx/conf.d/brotli.conf
configuration file to configure your Brotli installation. For more information about configuring Brotli, read the NGINX Brotli module documentation.
gzip
To use gzip, install the ea-nginx-gzip
package in the Additional Packages section of WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).
You can use the /etc/nginx/conf.d/gzip.conf
configuration file to configure your gzip installation. For more information about configuring gzip, read the NGINX gzip module documentation.
HTTP2
To use HTTP/2 with NGINX, you must install the ea-nginx-http2
package. You can install this package in the Additional Packages section of WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).
When you install the ea-nginx-http2
package, the system creates the /etc/nginx/conf.d/http2.conf
file. This is a comment-only file that you can use to set your system’s HTTP/2 configuration. NGINX only supports HTTP/2 via SSL. NGINX terminates the protocol when it sends a proxy request to Apache that uses HTTP/2. NGINX uses HTTP 1.1 to communicate with Apache.
We don’t require the Apache mod_http2
module if you wish to use HTTP/2 on a system that runs NGINX.
NGINX JavaScript Module (NJS)
The NGINX JavaScript module (NJS) allows you to use NGINX’s JavaScript-based scripting language with your NGINX server. To use NJS, install the ea-nginx-njs
package in the Additional Packages section of WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).
You can use the /etc/nginx/conf.d/njs.conf
configuration file to configure your NJS installation.
For more information, read the NGINX NJS documentation.