Network

The apachectl command

Controls and checks Apache. With configtest it validates the config and with -S it lists the virtual hosts.

Syntax

apachectl [configtest | -S | -v]Try it in the terminal →

Most useful options

configtestValidates the config (Syntax OK)
-SLists the virtual hosts

Copy-ready examples

$ sudo apachectl configtestValidate the config
$ sudo apachectl -SSee the vhosts

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • If a vhost DocumentRoot does not exist, configtest fails.

Related commands

FAQ

Where are the vhosts?

In /etc/apache2/sites-available; enabled with a2ensite.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course