Updated: 30 September 2026 · Applies to: cPanel & WHM 138 with EasyApache 4 on AlmaLinux, Rocky Linux and CloudLinux
Varnish is a caching reverse proxy: it sits in front of the web server, keeps copies of pages in memory and serves repeat visitors from there. The old version of this article installed Varnish by hand on a CentOS cPanel server and moved Apache to port 8080. We no longer recommend that on cPanel servers, for three reasons:
- cPanel does not manage Varnish. It is not part of cPanel or EasyApache 4, so cPanel updates, new accounts, new domains and SSL certificates are not coordinated with it. Every change needs manual work, and cPanel support cannot help with it.
- cPanel has its own caching reverse proxy. The NGINX reverse proxy (
ea-nginx) does the same job and is integrated with cPanel. - Caching dynamic sites needs care. Shops, member areas and logged-in users must never receive another visitor's cached page. That needs rules per application, whichever cache you use.
The supported way: cPanel's NGINX reverse proxy
- In WHM, open Software > NGINX Manager and install NGINX. cPanel moves Apache to other ports itself; on our cPanel & WHM 138 test server it runs on ports 81 and 444 behind NGINX.
- New accounts and domains are added to NGINX automatically. Page caching is on by default for each account.
- After you change a site, clear its cache:
/usr/local/cpanel/scripts/ea-nginx clear_cache USERNAME. - Restart NGINX only with
/usr/local/cpanel/scripts/restartsrv_nginxor WHM's Service Manager.
For WordPress sites, combine it with a caching plugin for page and object caching; see how to speed up WordPress with Redis or Valkey object caching.
If you really need Varnish
Some applications, such as large online shops, ship configurations written for Varnish. In that case, run Varnish on its own front-end server (or a managed caching service) in front of the cPanel server, instead of on the cPanel server itself. That keeps cPanel's own configuration untouched, and you can update or restart the cache without affecting the hosting server.
Need help choosing or setting up caching? Our cPanel server management team can do it for you.
Official documentation: cPanel: NGINX with reverse proxy and cPanel: caching with NGINX.