Ed McLaughlin
Ed McLaughlin

Reputation: 197

Is there a command to display apache vhost config?

I work on a development system that has hundreds of virtual hosts and vhost configs. Manually identifying which file path, hostname and vhost configs are related can be time consuming and may not always produce accurate or complete results.

Is there an Apache command that will display the vhost configurations related to a given hostname or path?

Upvotes: 0

Views: 271

Answers (2)

S van Balen
S van Balen

Reputation: 288

Given that your vhosts are neatly organised in files, and those files somewhat represent the hostname this might work on the command line

grep "DocumentRoot" /etc/apache2/sites-enabled/*

Upvotes: 0

Remi Gacogne
Remi Gacogne

Reputation: 4853

I am afraid there is no such command, but you can use 'apache2ctl -S' (or 'httpd -S', depending on your distribution) to have a list of every Virtual Hosts and where they are defined.

Note that -s is a shorter synonym for '-t -D DUMP_VHOSTS'.

Upvotes: 1

Related Questions