Solve Apache error AH01276 Cannot serve directory








The Apache error AH01276: Cannot serve directory occurs when there is an issues with the index file of the DirectoryIndex which is specified in the configuration file "httpd.conf".


We have experienced this error on many occasion and have helped customers resolved web server related issues as part of our Server Support Services.

In this context, we shall look into the causes of this error and how to get rid of it.



More about Apache error AH01276: Cannot serve directory DirectoryIndex

This error "No matching DirectoryIndex" is trigerred when trying to get access to applications which possesses an index.php file other than an index.html or other associated directory index file.

As a default, the DirectoryIndex for Apache is set to the following;


<IfModule dir_module>
DirectoryIndex index.html
</IfModule>


This simply signifies that when served on a web browser client, the index.html file will be processed by Apache web server.

Thus, in the process of accessing this data by phpMyAdmin, Apache will result in an error provided below;


[autoindex:error] [pid 20115] [client 10.30.6.80:50800] AH01276: Cannot serve directory /usr/share/phpMyAdmin/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive


How to Solve Apache Error: No matching DirectoryIndex

The easiest method of fixing this error is by modifying the Apache configuration file "httpd.conf". This process involves adding index.php to the directive of the DirectoryIndex.

You can edit the file via the command below;


vim /etc/httpd/conf/httpd.conf


Once the file is opened, look for the line as show below;


<IfModule dir_module>
DirectoryIndex index.html
</IfModule>


And replace it with the following;


<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>


Now you can save and exit this file after which you should do a restart of apache via the command below;


systemctl restart httpd


In other cases this error can result from exceeding max allowed processes by the PHP-FPM. A quick fix to this error would be to increase the max allowed processes value.

Finally, you can also force Apache to allow the user to the particular file with RedirectionMatch specification in the .htaccess file.


Need support in solving Apache errors? You can contact us now.



Conclusion

The solution to Apache server error No matching DirectoryIndex is here in this Article.



For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com