Overview:
In some rare cases, Apache (also known as httpd) may not be properly installed or may be missing after a fresh cPanel/WHM installation. Without Apache, hosted websites on the server will be inaccessible. This article provides a command to reinstall the Apache web server and all necessary modules to ensure proper functionality.
Symptoms:
-
Websites show "Connection Refused" or "Service Unavailable"
-
Apache service (
httpd) is missing or fails to start -
No Apache-related packages are found on the server
Environment:
-
cPanel/WHM Server
-
AlmaLinux, Rocky Linux, CentOS (with
yumpackage manager) -
EasyApache 4
Solution:
To reinstall Apache and its required modules, run the following command as the root user:
yum install ea-apache24 ea-apache24-mod_mpm_prefork ea-apache24-mod_cgi ea-apache24-mod_ssl ea-apache24-config-runtime ea-apache24-tools -y --allowerasing
Explanation of Packages:
-
ea-apache24: Main Apache 2.4 package provided by EasyApache 4 -
ea-apache24-mod_mpm_prefork: Required MPM module for compatibility with some PHP handlers -
ea-apache24-mod_cgi: Enables CGI support -
ea-apache24-mod_ssl: Enables SSL (HTTPS) support -
ea-apache24-config-runtime: Base runtime configuration for Apache -
ea-apache24-tools: Utility tools for Apache management
After Installation:
Once installed:
-
Restart Apache using:
systemctl restart httpd -
Check Apache Status:
systemctl status httpd -
Verify Website Accessibility:
-
Open a browser and visit your hosted domains.
-
They should now load properly if DNS and virtual host configs are set correctly.
-
Additional Notes:
-
This solution applies to cPanel servers using EasyApache 4.
-
Ensure your server has network access to the cPanel package mirrors.
-
If you're using a custom Apache configuration or 3rd-party modules, consider backing up your configuration before reinstalling.
