There are several methods to start, stop, and restart the Apache 2 web server on Linux. Choose the one that works for you, depending on your Linux distribution.
To restart Apache 2 web server on Linux, use one of these commands:
sudo service apache2 restart
sudo /etc/init.d/apache2 restart
sudo service httpd restart
sudo /etc/init.d/httpd restart
sudo systemctl restart httpd.service
sudo apachectl -k restart
sudo apachectl -k graceful

To stop Apache 2 web server on Linux, use one of these commands:
sudo service apache2 stop
sudo /etc/init.d/apache2 stop
sudo service httpd stop
sudo /etc/init.d/httpd stop
sudo systemctl stop httpd.service
sudo apachectl -k stop

To start Apache 2 web server on Linux, use one of these commands:
sudo service apache2 start
sudo /etc/init.d/apache2 start
sudo service httpd start
sudo /etc/init.d/httpd start
sudo systemctl start httpd.service
sudo apachectl -f /usr/local/apache2/conf/httpd.conf

Bonus tip: To check Apache 2 status, use one of these commands:
sudo service apache2 status
sudo /etc/init.d/apache2 status
sudo service httpd status
sudo /etc/init.d/httpd status
sudo systemctl status httpd.service
