Are you looking for a solution to the ‘Apache Error: No matching DirectoryIndex’? We can help you fix it.
Here at Bobcares, we have seen several such apache related errors as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the causes for this error and see the fix.
Why no matching DirectoryIndex error occurs
Generally, this error occurs when you try to access the applications that have an index.php or other index files other than index.html. By default, index.html will be mentioned in the configuration file.
For example, upon installation, the phpMyAdmin includes an index.php but not an index.html file.
By default Apache is configured with the following:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
This means that Apache will only look for directory index files that are named index.html. As a result, while accessing the phpMyAdmin, Apache throws the following error:
This error occurs due to different reasons. They are not mentioning the index page in the list of DirectoryIndex, PHP-FPM hits a limit of max allowed processes, not enabling the dir module in the Plesk panel.
How we fix no matching DirectoryIndex
Here are the different ways our Support Engineers follow to resolve this error.
1. We add the corresponding index file to DirectoryIndex. If it phpMyAdmin then we add the index.php file to the DirectoryIndex directive as shown in the below command.
vim /etc/httpd/conf/httpd.conf
After running the above command and accessing the configuration file, we change the below code
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
to:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
After making the changes, we exit and save the file with the command :wq
Also, we make sure to restart the Apache. For that, we run the below command.
systemctl restart httpd
2. We also, increase the value of the max allowed processes to fix this error.
For example, in DirectAdmin servers, this can be set to 30 using the commands given below:
/usr/local/directadmin/directadmin set php_fpm_max_children_default 30
cd /usr/local/directadmin/custombuild/
./build rewrite_confs
3. Another way to get rid of this error is to enable the dir Apache module.
For that we go to Tools & Settings >> Apache Web Server >> Select dir module >> Click OK to apply changes
“IncludeOptional mods-enabled/*.conf” should be included to the /etc/apache2/apache2.conf:
# grep “IncludeOptional mods-enabled/\*\.conf” /etc/apache2/apache2.conf
IncludeOptional mods-enabled/*.conf
This way we fix this Apache error.
[Need any further assistance in fixing Apache errors? – We are here to help you]
Conclusion
In short, this error occurs when you try to access the applications that have an index.php or other index files other than index.html. Today, we saw how our Support Engineers resolve this error.
0 Comments