To start, stop, or restart the Apache web server via SSH, you can use the systemctl
command. Here’s how to do it:
- Connect to your server using SSH.
- To start Apache, enter the following command:
sudo systemctl start httpd
This will start the Apache web server.
- To stop Apache, enter the following command:
sudo systemctl stop httpd
This will stop the Apache web server.
- To restart Apache, enter the following command:
sudo systemctl restart httpd
This will stop and then start the Apache web server.
- To check the status of Apache, enter the following command:
systemctl status httpd
This will display the status of the Apache web server and whether it is running or stopped.
Note that the httpd
service name may differ depending on the Linux distribution you’re using. For example, on some distributions, the service name may be apache2
instead of httpd
.