Restart Apache on Ubuntu
|
Use the following systemctl command on Debian Linux version 8.x+ or Ubuntu 15.04+ or above:
# Start command #
systemctl start apache2.service
# Stop command #
systemctl stop apache2.service
# Restart command #
systemctl restart apache2.service
As an alternative, you can also use the commands below
# Start command #
sudo service apache2 start
# Stop command #
sudo service apache2 stop
# Restart command #
sudo service apache2 restart
To view the status of the apache2 webserver use the following
sudo systemctl status apache2.service
You should then see an output like below.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-11-04 16:27:46 EDT; 3s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 163085 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 163089 (apache2)
Tasks: 13 (limit: 75807)
Memory: 703.4M
CGroup: /system.slice/apache2.service
├─163089 /usr/sbin/apache2 -k start
├─163090 /usr/sbin/apache2 -k start
├─163091 /usr/sbin/apache2 -k start
├─163092 /usr/sbin/apache2 -k start
├─163093 /usr/sbin/apache2 -k start
├─163094 /usr/sbin/apache2 -k start
├─163097 /usr/sbin/apache2 -k start
├─163098 /usr/sbin/apache2 -k start
├─163099 /usr/sbin/apache2 -k start
├─163101 /usr/sbin/apache2 -k start
├─163102 /usr/sbin/apache2 -k start
├─163103 /usr/sbin/apache2 -k start
└─163106 /usr/sbin/apache2 -k start
Nov 04 16:27:46 ip-x-x-x-x systemd[1]: Starting The Apache HTTP Server...
Nov 04 16:27:46 ip-x-x-x-x systemd[1]: Started The Apache HTTP Server.