1K
Following post show how to you start / stop / restart Apache server from linux command line.
There are various command set to start / stop / restart your Apache server from command line.
- systemctl command (works with Ubuntu 16.04LTS and above)
- /etc/init.d/apache2 (script to restart under Debian or Ubuntu Linux)
- service command (works with most of the Debian and Ubuntu distribution)
- apache2ctl command (works with all Linux & Unix based systems)
systemctl
$ sudo systemctl start apache2.service
$ sudo systemctl stop apache2.service
$ sudo systemctl restart apache2.service
$ sudo systemctl status apache2.service
/etc/init.d/apache2
$ sudo /etc/init.d/apache2 start
$ sudo /etc/init.d/apache2 restart
$ sudo /etc/init.d/apache2 stop
service$ sudo service apache2 restart
$ sudo service apache2 stop
$ sudo service apache2 start
$ sudo service apache2 reload
(Reloads Apache Server gracefully)
apache2ctl$ sudo apache2ctl start
$ sudo apache2ctl stop
$ sudo apache2ctl restart
$ sudo apache2ctl graceful (Reloads Apache Server gracefully)