Customizing NGINX with Reverse Proxy in cPanel & WHM

This article explains how to customize NGINX with reverse proxy on cPanel & WHM servers. It covers global configuration settings, custom .conf files, server block customization, user-level configuration, Cloudflare management, file access restrictions, increasing worker processes, and enabling the X‑Cache‑Status header.ز

NGINX customizationreverse proxy configurationcPanel NGINX settings

~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-Alivekeepalive When set to On, NGINX uses a value of 32. To use a custom value, edit /etc/nginx/ea-nginx/settings.json.
  • Keep-Alive Timeoutkeepalive_timeout NGINX uses only the value set in WHM.
  • Max Keep-Alive Requestskeepalive_requests If 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_time
  • worker_shutdown_timeout
  • worker_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: false to /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:

  1. Edit /etc/nginx/ea-nginx/settings.json.
  2. Increase the worker_processes value (doubling is recommended).
  3. Test configuration:
nginx -t

If successful, restart NGINX.




10. Add the X-Cache-Status Header


To track cache behavior:

  1. Edit /etc/nginx/ea-nginx/cache.json.
  2. 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

Related Articles

How to Restore Your cPanel Account: A Complete Guide for New System Administrators

This guide explains how new system administrators can restore a cPanel account using WHM, transfer accounts and configurations between servers, and enable diagnostic logging for transfer and restore operations. It covers essential concepts such as WHM vs. cPanel, root access, backup handling, SFTP uploads, transfer methods, and advanced debugging tools.

Continue

آموزش کامل انتقال تمام اکانت‌های cPanel از یک سرور به سرور دیگر

این مقاله نحوه انتقال همه اکانت‌های cPanel، تنظیمات سرویس‌ها، گواهی‌های SSL و IP اصلی سرور را از یک سرور قدیمی (Source) به یک سرور جدید (Target) توضیح می‌دهد. شامل نصب سرور جدید، انتقال تنظیمات، انتقال اکانت‌ها، تغییر IP، تنظیم DNS و نصب مجدد SSL است.

Continue

How to Migrate a WordPress® Installation to a cPanel & WHM Server

This guide explains how to migrate a WordPress installation from a macOS-hosted environment to a cPanel & WHM server. It covers exporting the database, uploading WordPress files, creating and importing a MySQL database, updating URLs, configuring wp-config.php, fixing broken links, and finalizing the migration.

Continue

How to Manually Transfer an Account Between Servers in cPanel & WHM

This article explains how to manually transfer a cPanel account between servers when the account is too large for WHM’s automated transfer tools. It covers creating temporary directories, compressing public_html and log files, securely transferring data with SCP, and restoring the files on the destination server.

Continue

How to Manually Migrate Horde Calendars and Contacts to Roundcube in cPanel & WHM

This article explains how to manually migrate Horde calendars and contacts to Roundcube in cPanel & WHM version 108 through 118. It covers exporting Horde data, placing it in the correct directories, and importing it into Roundcube using built‑in plugins or manual import tools.

Continue

How to Manually Migrate Accounts to cPanel & WHM from Unsupported Control Panels

This article explains how experienced system administrators can manually migrate accounts from unsupported third‑party control panels to cPanel & WHM. It covers pre‑migration steps, installation requirements, file and directory transfers, database restoration, SSL migration, and post‑migration tasks.

Continue