Instead of skipping to how to restart your Linux server, read the entirety of the guide for better understanding of the pros and cons.
When a PC slows down, we all know restarting it as a quick solution. This is good enough for users who don’t audit system logs to investigate the matter. Usually, the best solution is to investigate running processes and better secure the system. With server hosting, this is especially important because it’s always online and you can’t disconnect it from the internet to work on it locally. Logs are your best friend during incident response procedures after a cyber attack.
Managed VPS, Cloud Server, and Dedicated Server hosting customers have the option to restart their Linux server in multiple ways. There are times when this is necessary. It shouldn’t be often, though. Below we’ll cover:
- When Should You Not Restart a Linux Server?
- When Should I Stop or Restart a Linux Server?
- How to Restart a Linux Server
When Should You Not Restart a Linux Server?
When a server is in use, there are always disk writes to a database, server log, or application. You may already know not to halt a system during an SSH connection with activity. Whatever you’re doing in the server terminal will end abruptly unless you started the process with
tmux. Here are other specific cases where you DO NOT want to restart your server immediately, and what you should do instead.
Your Website or Email Doesn’t Work Correctly
Each popular content management system (CMS) has common errors, hopefully with well documented solutions. Performance demands climb every year with new technologies like HTTP/3 and NVMe drives. And of course, cyber attacks are always on the rise. Any of these situations can affect website and server performance. Instead of restarting your server, check if:
- Your website loads properly on another device and for other countries with web apps like GeoPeeker and ShotSherpa
- Your hosting provider has noted outage issues
- You’re receiving a lot of orders from your eCommerce store
- Your web analytics application or social media indicates posts that may be viral
- Error logs indicate database, misconfiguration, denial of service (DoS), or other malicious issues
If this is a constant issue, consider one or more of the following:
- Caching integrations for your CMS (e.g. W3TC WordPress plugin and Drupal native caching options)
- Server caching (e.g. NGINX)
- A content delivery network (CDN) and web application firewall (WAF) solution such as Cloudflare and Sucuri
When you have email issues, usually you receive some type of bounceback error. Restarting the server won’t fix those errors.
Check your email client settings if you can’t send email.
Check local firewall settings if you can’t send email while using a virtual private network (VPN).
If your emails deliver to spam / junk folders, improve your email authentication settings.
You Installed Something
Many installation guides for server level software instruct you to “restart your VPS” at some point. Popular examples include Apache modules, new PHP versions, and SSH port changes. Most times, you only need to restart the web server application.
systemctl restart apache2
systemctl nginx restart
WebHost Manager (WHM) can do this as well under Restart Services.
The Server Hasn’t Been Restarted in Awhile
Going back to restarting PCs, Linux servers normally have log optimization methods already in place to save disk space. Usually, it’s compressing older logs in tar files and deleting them after a certain amount of time.
When Should I Stop or Restart a Linux Server?
The most common situations when you DO want to restart your server:
Some major update, installation, and uninstallation processes require rebooting the server. Read the instructions carefully to ensure it states to restart the server instead of just the web server application.
Test Server Restart Feature
You should be sure that all installed applications will start without issue after a reboot. You don’t know when you or your hosting provider may need to apply critical updates which require a reboot while you’re sleeping.
For VPS administrators, if your hosting provider starts disaster recovery procedures for their cloud infrastructure, your virtual server may be restarted as part of a node. Remember, a VPS or cloud server (cloud VPS) shares a physical server with other customers. In some instances, you may have a temporary issue due to something outside of your control.
Save Money with a Virtual Private Cloud (VPC)
Unlike a VPS, a virtual private cloud (VPC) can expand to meet peaking resource demands and is pay-per-usage in seconds/hours online instead of a monthly subscription. If you don’t need your VPC on, shut it off. But ensure installed applications will start correctly before doing so.
How to Restart a Linux Server
Managed VPS, Cloud Server, and Dedicated Server hosting customers can restart your Linux server in AMP, WHM, or SSH. Remember, rebooting the server restarts Apache, MySQL, and email as well.
You can’t restart a shared server because you don’t have a virtual system and root access. You have a cPanel account on a shared physical server. Shared servers rarely need to be restarted unless our system administrators see an issue requiring it. If you have website issues which you believe result from the server, contact technical support for further assistance.
How to Restart Your VPS in AMP
You do not need root access for this.
- Log into AMP.
- Locate the server hosting account and select Restart VPS.
- Read the warnings. If you’re sure, select Restart VPS.
How to Restart Your Linux Server in WHM
You may need root access for this, depending on your cPanel user privileges in WHM.
- Log into WHM.
- On the left under System Reboot, select Graceful Server Reboot or Forceful Server Reboot. Use the graceful method because it prompts cPanel to finish user-level processes and not start anything new, preventing data corruption. The forceful method is the hard reset option you should only use if the graceful option doesn’t work.
You can restart individual services in WHM under Restart Services.
How to Restart Your Linux Server via SSH
You will need root access to execute the following commands in SSH or WHM Terminal.
It’s generally best to use AMP or WHM to do this on cPanel servers to prevent data loss.
Restart your server:
shutdown -r now
shutdown -r 0
Shutdown your server:
Learn more about managing your Linux server hosting from our VPS Hosting Product Guide.