Skip to content

Enabling and disabling Apache modules cleanly on a cPanel server

How to add or remove an Apache module on cPanel/WHM without breaking EasyApache 4's state — through profiles and packages, not by editing httpd.conf includes by hand.

A developer asks for mod_proxy_fcgi to be enabled. The instinct is to drop a LoadModule line in a conf.d/ snippet. On a cPanel server, that snippet survives until the next EasyApache 4 provision, then disappears without warning. The right way to add or remove an Apache module is through EasyApache itself, so the change persists across rebuilds and shows up in saved profiles.

What’s happening

Apache on cPanel is built from ea-apache24-* RPMs. Each module is its own package: ea-apache24-mod-proxy-fcgi, ea-apache24-mod-headers, ea-apache24-mod-deflate. The LoadModule directives live in /etc/apache2/conf.modules.d/, which is fully regenerated by EasyApache 4 from the installed RPM set on every provision and on /scripts/rebuildhttpdconf. Manual edits in that tree do not survive. The supported way to control loaded modules is the WHM EA4 UI or the underlying whmapi1 call.

How to verify

List what is currently loaded and what is installed:

apachectl -M | sort
rpm -qa | grep ea-apache24-mod | sort
whmapi1 ea4_list_profiles
ls /etc/apache2/conf.modules.d/

Compare apachectl -M against the RPM list. Anything in the RPM list but missing from apachectl -M is installed but not loaded — usually because it was disabled in the profile. Anything loaded but not in the RPM list is a hand-edited rogue snippet that will not survive the next provision.

The fix

  1. To enable a module, install it via EasyApache: WHM > EasyApache 4 > Customize current profile, walk to Apache Modules, check the module, then Provision. The UI calls the same backend as yum install ea-apache24-mod-<name> followed by config regeneration.
  2. For scripted environments, install the RPM directly and rebuild config: yum install -y ea-apache24-mod-headers && /scripts/rebuildhttpdconf && apachectl -t && apachectl graceful.
  3. To disable a module, do not just remove the LoadModule line — remove the package: yum remove ea-apache24-mod-<name> and rebuild. If other modules depend on it, yum will tell you; resolve those first.
  4. Save the new state as a custom profile so the change is captured: WHM > EasyApache 4 > Customize > Review > Save as Profile.
  5. Document the change in your config repo. A profile JSON diff between yesterday and today should match exactly one line item per module change.
  6. If a developer asks for a module that does not have an ea-apache24-mod-* package, that is a signal that the module is non-standard for cPanel and should be evaluated against the support boundary before being installed.

For environments where module changes must persist through quarterly EasyApache rebuilds, Stack Harbor handles this via profile management in WHM server management.