Apach部署php应用报错 Apache Error: No matching DirectoryIndex


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/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2026 CODEPRJ.COM