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:
- Connect to your server using SSH.
- To start Apache, enter the following command:
sudo systemctl start httpdThis will start the Apache web server.
- To stop Apache, enter the following command:
sudo systemctl stop httpdThis will stop the Apache web server.
- To restart Apache, enter the following command:
sudo systemctl restart httpdThis will stop and then start the Apache web server.
- To check the status of Apache, enter the following command:
systemctl status httpdThis 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.
