How to Restart cPanel Services: A Step-by-Step Guide


If you manage a web hosting server using cPanel, you might occasionally need to restart certain services to troubleshoot issues or apply configuration changes. Restarting services can help resolve problems related to web access, email, and other server functionalities. In this guide, we’ll walk you through the steps to restart cPanel services using various methods.

1. Using whmapi1 for Service Restart

For a comprehensive restart of cPanel services, the whmapi1 command is a convenient option. This command is built into WHM (Web Host Manager) and allows you to restart all necessary services efficiently.

Steps:

  1. Log in to your server via SSH as the root user.
  2. Execute the following command:
   /usr/local/cpanel/bin/whmapi1 restart_services

This command will handle the restart of all essential cPanel services, including the web server, email server, and more.

2. Restarting Specific cPanel Services

Sometimes, you might need to restart specific services rather than all services. Here’s how you can do that:

  • Restart cPanel Service:
  /scripts/restartsrv_cpsrvd
  • Restart Apache (HTTPD):
  /scripts/restartsrv_httpd
  • Restart DNS Server (BIND):
  /scripts/restartsrv_named
  • Restart Exim (Mail Server):
  /scripts/restartsrv_exim
  • Restart Dovecot (IMAP/POP3 Server):
  /scripts/restartsrv_dovecot
  • Restart MySQL:
  /scripts/restartsrv_mysql
  • Restart FTP Server (ProFTPd):
  /scripts/restartsrv_proftpd

3. Alternative Method: Using Service Commands

You can also use traditional service management commands to restart individual services. This method is suitable for environments where you prefer using service commands:

  • For Apache:
  service httpd restart
  • For MySQL:
  service mysqld restart
  • For Exim:
  service exim restart
  • For Dovecot:
  service dovecot restart
  • For FTP (ProFTPd):
  service proftpd restart

Important Considerations

  • Impact on Users: Restarting services can temporarily disrupt access to websites or email services. It’s best to perform these actions during low-traffic periods.
  • Backup: Always ensure you have recent backups of your server configurations and data before restarting services.
  • Troubleshooting: If you encounter issues after a restart, check your server logs for error messages that might provide clues for troubleshooting.

Restarting cPanel services is a routine part of server management that can help maintain smooth operation and resolve issues. By following these steps, you can efficiently manage and troubleshoot your server services.