Cloud Service >> Knowledgebase >> How To >> How to Restart Apache Server from WHM?
submit query

Cut Hosting Costs! Submit Query Today!

How to Restart Apache Server from WHM?

For online applications and web pages, Apache is one of the most widely used web servers When managing Apache in a shared hosting environment, you may often need to restart the server for a number of reasons, such as:

  • Applying configuration changes

  • Enabling new modules or features

  • Clearing cache and reloading content

  • Troubleshooting issues or errors

To conveniently administer their servers and hosted services, the majority of web hosting companies give a control panel like cPanel or WHM (Web Host Manager). We'll concentrate on using the WHM interface to restart the Apache web server in this tutorial.

Understanding Apache on Shared Hosting

On a shared hosting environment, multiple websites and accounts reside on a single server. Each account is essentially a separate instance allocated server resources like CPU, RAM, and disk space.

The web server software, in this case Apache, runs globally across the entire server, serving content for all hosted sites and accounts. When you restart Apache, it applies to all sites hosted on that server.

Web hosts take special measures like using a parent-child Apache configuration to isolate accounts and prevent conflicts. However, a restart is still occasionally required when global changes are needed.

Accessing WHM Interface

Restarting Apache requires first logging into your server's Web Host Manager (WHM) interface. The management interface for servers and hosting accounts is the administration-level control panel, or WHM.

To log into WHM, you need to provide the hostname or IP address of the server, followed by ":2086" or ":2087". As an example:

https://hostname.com:2087

https://123.45.67.89:2086

You'll be prompted to enter the root user's WHM access credentials, which are different from individual cPanel credentials.

Restarting Apache Server from WHM

Once logged into WHM, you can restart the Apache server by following these steps:

  • Locate the 'Service Manager' section

This is typically under the "Server Status" section in the left sidebar menu.

  • Click on the 'Restart Apache' link/button

This will be listed under the Apache service details.

  • Confirm the restart action

You may be asked to confirm that you want to restart the Apache web server. Click "Yes" to proceed.

  • Wait for Apache to restart

A progress bar or message will indicate that Apache is restarting. Wait for this process to complete, which can take 30-60 seconds.

  • Verify Apache is running

Check the service status details and ensure Apache shows as "Running" with the updated process ID.

And that's it! The Apache web server should now be successfully restarted on your server. Any configuration changes you made will be applied, and all hosted sites should be serving content from the updated environment.

Restarting Apache via Command Line

While the WHM interface provides a user-friendly method, you can also restart Apache using the command line if needed.

  • Log into WHM terminal

In the WHM sidebar menu, navigate to Terminal > Terminal Classic or Terminal Regexp.

  • Stop Apache gracefully

apachectl -k graceful-stop

  • Wait for all processes to stop

Monitor process list via httpdctl status

  • Start Apache again apachectl -k start

  • Verify Apache is running httpdctl status

This shutdown and restart approach helps clear any stuck processes and ensures a clean restart of the server.

Alternatively, you can use the shorter command for graceful restart in one step:

apachectl graceful

This attempts a graceful restart by reloading configuration files without disconnecting current requests.

When to Restart Apache Server

In general, you'll want to restart the Apache server under the following circumstances:

  • Enabling new modules or features: After installing new Apache modules like modifying PHP version, restarting applies changes.

  • Changing server configurations: Updates to Apache configurations like changing port numbers require a restart.

  • Deploying web application updates: Restarting clears caches and loads updated code/content for web apps.

  • Applying security patches and updates: Critical system patches are incomplete until services are restarted.

  • Recovering from errors or failures: Sometimes restarting is needed to recover Apache from errors or failed deployment.

  • Managing low resources: An Apache restart can free up RAM and resources on the server in some cases.

  • Scheduled maintenance: Many hosts restart Apache periodically as part of standard maintenance routines.

Do note that restarting Apache will temporarily interrupt any ongoing HTTP requests until the restart completes. Plan accordingly and restart during low-traffic periods.

Additional WHM Apache Management

Beyond just restarting, the WHM interface provides additional tools to help manage Apache effectively on your server:

  • Multi-Node Apache Manager: View status and configure Apache across multiple nodes/servers.

  • Profile Manager: Create Apache configuration profiles to share settings across accounts.

  • Apache Disallow Wizard: Prevent specific clients from accessing Apache based on IP rules.

  • Application Manager: Install, update or remove Apache modules and extensions.

  • Service Manager Scripts: Customize scripts to run before/after Apache restarts.

  • Apache Status: Monitor real-time Apache health, processes and more via status reports.

These additional capabilities in WHM allow web hosts to have granular control over their Apache servers and optimized configurations based on their needs.

Conclusion

Restarting the Apache web server is a frequent requirement when managing web hosting environments. Whether enabling new features, applying updates or troubleshooting issues, having the ability to restart Apache seamlessly is crucial.

The Web Host Manager (WHM) offers an easy-to-use interface to quickly restart Apache servers with just a few clicks. Additionally, the command line remains an option for more advanced administration when needed.

With the knowledge gained from this guide, you can now confidently restart Apache via WHM to keep your hosted websites and applications running smoothly and reliably.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!