- Apache Error: No matching DirectoryIndex – How we rectify it
- What is Apache Error: No matching DirectoryIndex?
- How to fix Apache Error: No matching DirectoryIndex
- 1. Apache misconfiguration
- 2. Max allowed processes
- Conclusion
- PREVENT YOUR SERVER FROM CRASHING!
- Исправляем 403 Forbidden в Apache на CentOS
- Воркэраунд
- [SOLVED] Apache Error: No matching DirectoryIndex
- General Reason for Apache Error
- Default Apache Configuration
- DirectoryIndex File Changes
- Save and Exit the File
- Restart Apache
- Wrapping Up
- Related Articles:
- Fix Apache Error: No matching DirectoryIndex easily
- What is Apache Error: No matching DirectoryIndex?
- How to fix Apache Error: No matching DirectoryIndex?
- Conclusion
- Solve Apache error AH01276 Cannot serve directory
- More about Apache error AH01276: Cannot serve directory DirectoryIndex
- How to Solve Apache Error: No matching DirectoryIndex
- Need support in solving Apache errors? You can contact us now.
- Conclusion
Apache Error: No matching DirectoryIndex – How we rectify it
Here at Bobcares, we have seen several such Apache errors as part of our Server Management Services for web hosts, Linux users, and online service providers.
Today we’ll take a look at the cause for this error and see how to fix it.
What is Apache Error: No matching DirectoryIndex?
This error arises when trying to access applications that have an index.php file (or other index file), but not an index.html or other specified ‘directory index’ file.
By default, index.html will be specified in the configuration file. For instant, while installing PhpMyAdmin, it includes an index.php file. However not an index.html file.
So the Apache configuration entry looks like the following:
This means Apache will only look for directory index files that are named index.html.
So, when trying to access phpMyAdmin, Apache gives the following error:
[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 directiveThe following are the main reasons to occur this error,
- Apache misconfiguration. That is the Index page not mentioned in the list of DirectoryIndex.
- PHP-FPM hits exceed the limit of max allowed processes.
- In Plesk servers, the dir module is not enabled.
How to fix Apache Error: No matching DirectoryIndex
Here are the different solutions provided by our Support Engineers to fix this error.
1. Apache misconfiguration
Specify the corresponding index file to DirectoryIndex. For an example of phpMyAdmin, add index.php to the DirectoryIndex directive.
Hence, it can be done by adding index.php to the DirectoryIndex directive in the apache configuration file /etc/httpd/conf/httpd.conf.
At last, restart Apache by using the following command,
2. Max allowed processes
Also, set a higher value for max allowed processes. In DirectAdmin servers, the following commands use to increase the value for max allowed processes.
/usr/local/directadmin/directadmin set php_fpm_max_children_default 30
cd /usr/local/directadmin/custombuild/
./build rewrite_confs
[Need any further assistance in Linux related errors? – We’re available to help you]
Conclusion
In short, this Apache Error: No matching DirectoryIndex occurs due to Apache misconfiguration and when exceed the limit of max allowed processes. Today, we saw how our Support Engineers provide a work-around for this error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
Исправляем 403 Forbidden в Apache на CentOS
Маленькая, но полезная заметка. Однажда, в один прекрасный день у нас перестала работать подмапленная в web — доступ директория (смонтирована она была через /etc/fstab ). Браузер возвращал 403 Forbidden Error. Не долго думая, смотрим, что происходит в логах при обращении к web. В режиме реального времени можно посмотреть командой:
tail -f /var/log/httpd/error_log
Итак, у нас там было следующее:
AH01276: Cannot serve directory /var/www/html/merion_directory/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
Хм. Дело в том, что у нас там просто выводится список папок, по файлам. Следовательно, сервак просто не может отрисовать эту структуру. Погнали исправлять
Воркэраунд
Лезем в конфигурационный файл нашего Apache:
vim /etc/httpd/conf/httpd.conf
И в общей области, где идут настройки директорий добавляем следующее:
Options Indexes FollowSymLinks
Где merion_directory — ваша директория в корне веб — сервера /var/www/html/, при обращении к которой вы получаете 403. Конфигурация проста — мы просто говорим апачу, что у нас там каталог файлов и его нужно «отрисовать» даже несмотря на то, что у нас там нет никаких index.html или index.php. По окончанию настройки ребуетаем Apache:
Или через systemctl. Ребутаем браузер (Ctrl + F5). Профит!
[SOLVED] Apache Error: No matching DirectoryIndex
An Apache error is a message generated by the Apache Web Server software and is usually a result of a coding issue or server misconfiguration. Apache errors may include Internal Server Error or 403 Forbidden messages. They can range from minor, easily fixed errors to more serious ones that may require support from a system administrator. Therefore, understanding the causes of Apache errors helps take the necessary steps to resolve the issue.
This article walks through solving the error: No matching DirectoryIndex (index.html) on CentOS 6 and 7 servers, logged in as root.
General Reason for Apache Error
This error may occur when attempting to access applications that have an index.php file (or another index file), but not an index.html or other specified directory index file. For example, phpMyAdmin includes an index.php file upon installation, but not an index.html file.
Default Apache Configuration
By default, Apache is configured with the following.
This configuration means that Apache will only look for directory index files that are named index.html. So, when attempting to access phpMyAdmin, Apache throws the following error.
[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
In this case, we want to add index.php to the DirectoryIndex directive. To do this, access the file from the text editor of your choice. This tutorial uses Vim.
vim /etc/httpd/conf/httpd.conf
DirectoryIndex File Changes
Locate the following configuration information within the configuration file.
Make the following change to the file to add index.php to the directive.
DirectoryIndex index.html index.php
Save and Exit the File
Save and exit the file once the appropriate changes are made. For Vim, exit and save the file with the :wq command.
Restart Apache
Restart Apache to implement the changes.
Wrapping Up
Solving the No matching DirectoryIndex Apache error is straightforward with the proper knowledge and understanding of the error’s underlying cause. Following this tutorial ensures the error is rectified easily.
Liquid Web offers managed hosting options to fit small to medium-sized businesses and enterprise workloads. Contact our sales team for a consultation on what best suits your business.
Related Articles:
Fix Apache Error: No matching DirectoryIndex easily
The “Apache Error: No matching DirectoryIndex easily” error triggers due to missing of the particular index file from DirectoryIndex section in httpd.conf file.
As a part of our Server Management Services, we help our Customers to fix webserver related errors regularly.
Let us today discuss the possible causes and fixes for this error.
What is Apache Error: No matching DirectoryIndex?
The “No matching DirectoryIndex” error occur while accessing applications that have index files other than index.html or other specified ‘directory index’.
For example, phpMyAdmin includes an index.php file upon installation, but not an index.html file.
By default Apache is configured with the following:
Thus Apache will only look for directory index files that has name as index.html. As a result, when attempting to access phpMyAdmin, Apache throws the following error:
[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 fix Apache Error: No matching DirectoryIndex?
The most common reason for this error is the missing of the particular index file from DirectoryIndex section in httpd.conf file. This can be easily fixed by editing the file. For instance, if it is to add index.php to add phpMyAdmin, it can be performed with the setof steps given below:
First step is to open the httpd.conf file with any of the available editors.
vim /etc/httpd/conf/httpd.conf
Now we need to identify the following set of lines in the configuration file.
Next task is to change it to the following format.
DirectoryIndex index.html index.php
Then save and exit the file. Finally, make sure to restart Apache with:
At times, this error can trigger when the PHP-FPM hits a limit of max allowed processes. We coulld fit it with an increase the value of max allowed processes. 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
In plesk environments, after a dist-upgrade, at time a 403 Forbidden is shown on all websites. The apache log shows the “No matching DirectoryIndex” in the apache error log.
To fix the error, enable the dir Apache module going to Tools & Settings > Apache Web Server > Select dir module > Click OK to apply changes
Note to include “IncludeOptional mods-enabled/*.conf” to the /etc/apache2/apache2.conf:
# grep "IncludeOptional mods-enabled/\*\.conf" /etc/apache2/apache2.conf IncludeOptional mods-enabled/*.conf
[Need any further assistance in fixing Apache errors? – We’re available 24*7]
Conclusion
In short, The “No matching DirectoryIndex” error occur while accessing applications that have index files other than index.html or other specified ‘directory index’. Today, we saw how our Support Engineers fix this error.
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;
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;
And replace it with the following;
DirectoryIndex index.html index.php
Now you can save and exit this file after which you should do a restart of apache via the command below;
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.