How to Restart Service on Linux Server

This guide was created to make it easier for you to manage all the services on your Linux server. In general, Linux-based servers do not have a GUI (Graphical User Interface) and are only based on text with a black screen as below.

But that doesn't mean it makes it difficult to restart the service.

Some services that are generally available on Linux servers:

  • Web Server (httpd, nginx)
  • Database Server (mysql, mariadb)
  • FTP server (proftpd, pureftpd)
  • MTA agent service (sendmail, postfix, exim, qmail)
  • SSH service (sshd, dropbear)
  • And there are many more.

Restart Web Server

If one of your services is not running (for example, the web server is down) then you can do a simple thing, namely restarting the service, in this case restarting the web server service.

With the references we have provided above, we check whether the web server service is on or not.

systemctl status httpd

If it is off, a message will appear on the offline indication screen.

However, if the web server service is on, the message should look something like this. You can see that there is an Active status in the message and it is highlighted.

If the web server service for example is offline, you can restart the service by :

systemctl restart httpd

Then wait a few seconds (1-2 seconds) until the service is successfully restarted. Usually, by restarting the service like this your service can be up again. In some cases, this troubleshooting method can usually overcome server services that are offline.

Restart FTP Server

On several occasions we sometimes find the FTP service hanging or not responsive, the first troubleshooting step we can do is restart the service, the same as the web server.

systemctl restart ftpd
systemctl restart proftpd

In some cases, the naming of the ftp service is usually different depending on what software you install.

Restart Database Server

When your website is slowing down, it is suspicious that the database server may be one of the reasons why your website is slowing down. However, before restarting the database server, you must remember that you must have a backup of the previous version of the database (in the form of .sql). Because it could be that when doing a database server and transactions are running, your database has crashed / corrupt.

To restart the database server:

systemctl restart mysqld

or if using mariadb

systemctl restart mariadb

However, for some specific cases there are those that need to require further handling, such as checking server logs and analyzing. If you have restarted the service but it does not go up, you can escalate it to our support team which is on standby 24 hours a day. If you have changed the root password and want our team to check, make sure you give the root access, or create an additional sudo user to facilitate our team's investigation.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.