How do restart or enable an Apache2 in Debian / Ubuntu / CentOS / RHEL / Fedora Linux or UNIX-like operating systems? follow the command to start or stop Apache 2 web server running on Linux.

First, login to your web server using ssh client, if the server is not in your local data centre:
ssh root@your-server-com #elyspace box
ssh cloud2-user@elyspace-ip-here # AWS
ssh vivek@191.12.112.100 # My home dev server

Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache

You can either use service or /etc/init.d/ command as follows on Debian Linux version 7.x or Ubuntu Linux version Ubuntu 14.10 or older:

Restart Apache 2 web server, enter:

# /etc/init.d/apache2 restart
OR
$ sudo /etc/init.d/apache2 restart
OR
$ sudo service apache2 restart

To stop Apache 2 web server, enter:

# /etc/init.d/apache2 stop
OR
$ sudo /etc/init.d/apache2 stop
OR
$ sudo service apache2 stop

To start Apache 2 web server, enter:

# /etc/init.d/apache2 start
OR
$ sudo /etc/init.d/apache2 start
OR
$ sudo service apache2 start

Use the following systemctl command on Debian Linux version 8.x+ or Ubuntu Linux version Ubuntu 15.04+ or above:
## Start command ##
systemctl start apache2.service
## Stop command ##
systemctl stop apache2.service
## Restart command ##
systemctl restart apache2.service

We can view status using the following command:
$ sudo systemctl status apache2.service

Comments to: How To Start / Stop and Restart Apache 2 Web Server Command

    Your email address will not be published. Required fields are marked *