Apache 主文档根不存在

ke4*_*ukz 5 apache document-root

/var/www/html我试图找到我的 Apache 配置中仍然存在对 的引用。当我运行时,apache2ctl -S它显示Main DocumentRoot: "/var/www/html",但我的虚拟主机或主 Apache 配置文件都没有指向该目录。

我尝试使用搜索所有配置文件grep -r "var/www/html" /etc/apache2/,但它什么也没返回。

我的文件中没有<Directory>该路径的条目/etc/apache2/apache2.conf(有一个/var/www,我在其下存储虚拟主机)。

这种配置怪癖困扰着我的强迫症,但我也经常在 Apache 错误日志中看到这些条目:

[Fri Jun 28 18:19:53.424619 2019] [autoindex:error] [pid 22665] 
[client 209.222.82.167:47376] AH01276: Cannot serve directory
   /var/www/html/: No matching DirectoryIndex 
   (default.php,index.php,index.html,index.htm) found, and server-generated
   directory index forbidden by Options directive
Run Code Online (Sandbox Code Playgroud)

Apache 如何决定主文档根是什么,以及如何更改它?

编辑:

对于我的可用站点/已启用站点,我有四个文件:000-default.conf000-default-le-ssl.conf000-www-default.conf000-www-default-le-ssl.conf。这000-default.conf是 certbot 设置的重定向,指向 https 站点,并且没有 DocumentRoot 指令。与ServerName000-www-default.conf相同000-default.conf(一个有 www,另一个没有);000-www-default-le.conf和 也遵循相同的模式000-default-le.conf

这是我尝试过的一些事情的输出:

ke4*_*ukz 6

正如 @Nic3500 指出的,/var/www/html是主 DocumentRoot 的默认值。更改虚拟主机配置不会影响这一点。但是,添加 DocumentRoot 指令apache.conf确实会改变它,如apache2ctl -S.

换句话说,我的主 DocumentRoot 未配置,并且使用默认值,直到我在全局配置文件中明确定义它为止。