apache2ctl is a command-line utility for controlling the Apache HTTP Server on Ubuntu. It allows you to start, stop, and restart the Apache server, as well as to check the status of the server and to perform other maintenance tasks. The Apache HTTP Server is a popular open-source web server used to host websites and web applications. It is included by default in Ubuntu, and it can be used to serve static and dynamic content over the internet.
If you encounter the below error while running the apache2ctl command:
apache2ctl: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install apache2 |
Ubuntu | apt-get install apache2 |
Alpine | apk add apache2 |
Kali Linux | apt-get install apache2 |
Raspbian | apt-get install apache2 |
apache2ctl Command Examples
1. Start the Apache daemon. Throw a message if it is already running:
$ sudo apache2ctl start
2. Stop the Apache daemon:
$ sudo apache2ctl stop
3. Restart the Apache daemon:
$ sudo apache2ctl restart
4. Test syntax of the configuration file:
$ sudo apache2ctl -t
5. List loaded modules:
$ sudo apache2ctl -M
6. To display the version and usage information for apache2ctl:
$ sudo apache2ctl -h