Apache 錯誤的一個一般原因
當嘗試訪問具有 index.php 文件(或其他索引文件)但沒有 index.html 或其他指定“目錄索引”文件的應用程序時,可能會發生此錯誤。 例如,phpMyAdmin 在安裝時包含一個 index.php 文件,但不包含一個 index.html 文件。
默認情況下,Apache 配置如下:
<IfModule dir_module> DirectoryIndex index.html </IfModule>
這意味着Apache只查找名為index.html的索引文件。
當部署php應用的時候,可能目錄下只有index.php文件,Apache會報下面的錯誤:
[autoindex:error] [pid 2080] [client 192.168.137.1:6617] AH01276: Cannot serve directory /var/www/html/zentaopms/www/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
這時,我們需要將index.php 添加到DirectoryIndex 指令下
修改配置文件
vim /etc/httpd/conf/httpd.conf
添加index.php
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
保存文件並且重啟Apache服務器
systemctl restart httpd
轉發地址:https://www.liquidweb.com/kb/apache-error-no-matching-directoryindex-index-html-found-solved/