简体   繁体   English

有命令显示apache vhost配置吗?

[英]Is there a command to display apache vhost config?

I work on a development system that has hundreds of virtual hosts and vhost configs. 我在一个具有数百个虚拟主机和vhost配置的开发系统上工作。 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? 是否有Apache命令显示与给定主机名或路径相关的虚拟主机配置?

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. 恐怕没有这样的命令,但是您可以使用“ apache2ctl -S”(或“ httpd -S”,具体取决于您的分布)来获得每个虚拟主机及其定义位置的列表。

Note that -s is a shorter synonym for '-t -D DUMP_VHOSTS'. 请注意,-s是“ -t -D DUMP_VHOSTS”的缩写。

鉴于您的虚拟主机被整齐地组织在文件中,并且这些文件在某种程度上代表了主机名,因此这可能在命令行上有效

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM