3.7.1 Server services. How to restart HTTP, MySQL, SMTP and others

Main banner The ISPmanager4 control panel offers a convenient way to manage system services such as MySQL, HTTP, SMTP, POP3, DNS. It allows you to manage these services both in a convenient interactive form, in the control panel itself, and through the command line in the terminal, using SSH protocol. In this article, we will consider in detail the process of managing services in both ways.

Management of system services using the ISPmanager4 control panel

In the ISPmanager4 control panel, there is a section dedicated to managing services, which is available under the root superuser, in the Tools - Services section. In which you will see a list of available services, such as a web server (Apache2/Nginx), databases (MySQL/PostgreSQL), mail servers (SMTP/POP3/IMAP) and others. In addition, you will have the opportunity to check the current state of the service and, if necessary, enable, disable or restart it.

Services in the panel

In case of peak load and server failure, some server services may shut down, leading to incorrect operation. If any of the services is stopped, which is indicated by the blue indicator – you can restart or enable it using the control buttons.

If the service does not start – then you need to connect via SSH and check the service manually. An error will be displayed if the startup fails. Problems can be of different nature, for example, a conflict in the configuration file, then we will consider how to manage services using SSH.

Managing services using SSH

With the help of SSH you will be able to manage system services directly from the command line. This gives you more flexibility and control over your servers. You can start, stop, and restart services, view their status and error logs, and make changes to configuration files. This method is especially useful for diagnosing problems and working with the server if the control panel is unavailable or not working properly. It is important to be authorized in the terminal under root.

Examples for each service:

HTTP (Apache2):
  1. service apache2 restart

or

  1. systemctl restart apache2

Possible commands: start/stop/restart/status

  • start: starts the service.
  • stop: stops the service.
  • restart: restarts the service.
  • status: shows the status of the service (started or stopped).
HTTP (NginX):
  1. service nginx restart

or

  1. systemctl restart nginx

Possible commands: start/stop/restart/status

MySQL:
  1. service mysql restart

or

  1. systemctl restart mysql

Possible commands: start/stop/restart/status

SMTP (Exim4):
  1. service exim4 restart

or

  1. systemctl restart exim4

Possible commands: start/stop/restart/status

POP3/IMAP (Dovecot):
  1. service dovecot restart

or

  1. systemctl restart dovecot

Possible commands: start/stop/restart/status

DNS (Bind/Named):
  1. service bind9 restart

или

  1. systemctl restart bind9

Possible commands: start/stop/restart/status

The above commands will restart the service. In case of any problem or failure, SSH provides detailed error information and diagnostic data to assist in troubleshooting.

Optional: if unable to authenticate as root superuser

You can preface the command with sudo to elevate your privileges to administrator level. Example:

  1. sudo service apache2 restart

or

  1. sudo systemctl restart dovecot

There are two commands that allow you to temporarily gain superuser privileges on the system sudo and su. However, there is a difference worth understanding – sudo allows you to execute one or more commands on behalf of the current user. In this case, the password of the current user is required, and the system temporarily increases its privileges, and after executing the command, it decreases them again.

Instead, the su command requires the target user’s password already.

  1. su

In fact, this command enables superuser mode and allows you to perform all actions with elevated privileges. Obviously, it’s safer to use sudo because this command only allows you to run specific tasks with elevated privileges, not all.

The options described above may not be available on every distribution, as the execution of the commands may be security restricted.