apache2ctl Command Examples in Linux

apache2ctl is a command-line utility for controlling the Apache HTTP Server on Ubuntu and Debian based distributions. 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.

Note: Note that the apache2ctl command requires root privileges to perform most tasks.

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
Related Post