↑ ↓ select, Enter open, Esc close

Show all Apache virtual hosts and their config files

root@server
apache2ctl -S

Shows, per IP and port, which virtual hosts Apache knows, which one is the default host, and the file and line where it is defined. Essential when a domain serves the wrong site, since usually the default host kicks in because no ServerName or ServerAlias matches.

Note: On Plesk, Apache usually listens behind nginx on ports 7080 and 7081, so the virtual hosts show up there.

Also searched as

  • list apache virtual hosts
  • apache serving wrong site
  • find apache default vhost
  • which file defines the virtualhost

Related one-liners

All in Apache

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.