Start / Stop / Restart Apache Web Server Via SSH

To start, stop, or restart the Apache web server via SSH, you can use the systemctl command. Here’s how to do it:

  1. Connect to your server using SSH.
  2. To start Apache, enter the following command:
sudo systemctl start httpd

This will start the Apache web server.

  1. To stop Apache, enter the following command:
sudo systemctl stop httpd

This will stop the Apache web server.

  1. To restart Apache, enter the following command:
sudo systemctl restart httpd

This will stop and then start the Apache web server.

  1. 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.

Leave a Comment