How to Reinstall Apache (httpd) on a cPanel Server

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 yum package 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:

  1. Restart Apache using:

    systemctl restart httpd
    
  2. Check Apache Status:

    systemctl status httpd
    
  3. 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.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Domain names are not showing in WHM

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...

How to Start/Stop or Restart Apache server

Apache is the HTTP server that is freely available over the internet. It is a kind of software or...

How to install Attracta SEO Tools plugin

RequirementscPanel/WHM needs to be installed on your server. Step 1: SSH into your server and go...

How to Install CpCleaner in cPanel through SSH?

Installation Run the following shell commands as root via SSH: wget -O cpc-1.0.3.tar...

How to Secure a cPanel/WHM Web Server

Here are a few basic steps that you should keep in mind for keeping a server secure. 1) Strong...