~3 min read • Updated Feb 22, 2026
1. Overview
You can customize NGINX® with reverse proxy in several ways on a cPanel & WHM server. These customizations include global configuration settings, server block adjustments, user-level configurations, Cloudflare integration, file access restrictions, and performance tuning.
2. Global Configuration Settings
You can configure certain NGINX directives through WHM’s Global Configuration interface:
WHM » Home » Service Configuration » Apache Configuration » Global Configuration
The following settings correspond to NGINX directives:
- Keep-Alive →
keepaliveWhen set to On, NGINX uses a value of 32. To use a custom value, edit/etc/nginx/ea-nginx/settings.json. - Keep-Alive Timeout →
keepalive_timeoutNGINX uses only the value set in WHM. - Max Keep-Alive Requests →
keepalive_requestsIf set to Unlimited, NGINX uses 1000.
3. Global Configuration Files
Place any global .conf files in:
/etc/nginx/conf.d/
To modify all server blocks, place your file in:
/etc/nginx/conf.d/server-includes/
Note:
You must reference your file using an include directive.
4. Server Blocks
To customize NGINX server blocks (equivalent to Apache virtual hosts), create a .conf include file in the appropriate directory.
Each server block automatically includes files from:
/etc/nginx/conf.d/server-includes/
Warning:
Do not use the prefix cpanel- for custom files.
5. User Configuration
Use the following paths to customize user-specific server blocks:
All server blocks for a user:
/etc/nginx/conf.d/users/username/
Specific domain:
/etc/nginx/conf.d/users/username/domainname/
Addon domains:
/etc/nginx/conf.d/users/username/addondomain.domainname/*.conf
6. Custom Server Configurations
Warning: Do not edit NGINX-owned files. Doing so may cause unexpected behavior.
To customize NGINX before installation, create:
/var/nginx/ea-nginx/settings.json
/var/nginx/ea-nginx/cache.json
During installation or rebuild, these files are copied to:
/etc/nginx/ea-nginx/settings.json
/etc/nginx/ea-nginx/cache.json
Supported directives in settings.json:
keepalive_timeworker_shutdown_timeoutworker_processes
Important: Files must contain valid JSON.
7. Manage Cloudflare Configuration
By default, NGINX configures Cloudflare proxies in:
/etc/nginx/conf.d/users/example.conf
To disable Cloudflare integration:
- Add
include_cloudflare: falseto/etc/nginx/ea-nginx/settings.json. - Rebuild or restart NGINX.
8. Restrict File Access
To block access to sensitive directories (e.g., .git), create a .conf file and add:
location ~ /\.git {
deny all;
log_not_found off;
access_log off;
return 404;
}
9. Increase NGINX Worker Processes
To increase worker_processes:
- Edit
/etc/nginx/ea-nginx/settings.json. - Increase the
worker_processesvalue (doubling is recommended). - Test configuration:
nginx -t
If successful, restart NGINX.
10. Add the X-Cache-Status Header
To track cache behavior:
- Edit
/etc/nginx/ea-nginx/cache.json. - Change:
"x_cache_header": false,
to:
"x_cache_header": true,
Important: Do not remove the comma.
Rebuild NGINX to apply changes.
Conclusion
With these customization options, you can fine‑tune NGINX behavior on your cPanel & WHM server. From global settings to user‑level configurations, Cloudflare management, file access restrictions, and performance tuning, NGINX provides a flexible and powerful reverse proxy environment.
Written & researched by Dr. Shahin Siami