No matching directoryindex index html found and server generated directory index forbidden

How to Solve Error Message AH01276: Cannot serve directory /: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

This article will discuss about how to solve an error message as exist in the title of this article itself. Basically, the context of this article is troubleshooting to solve why a web-based application using Yii framework is not working. The actual error message exist as follows :

AH01276: Cannot serve directory /folder-path-root-web-location/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

The error above exist after searching the cause in the error log file of Apache Webserver. It is because in the default root folder of the web-based application using Yii framework there is no file with the name of ‘index.html’ or ‘index.php’. Actually, there is a reason for Apache Webserver looking for the ‘index.html’ or ‘index.php’ file for initial execution of the web-based application. The reason is available in the Apache Webserver’s virtual host web-based application configuration. The configuration itself can exist in the main Apache Webserver’s file configuration. But it can also exist in other file configuration focusing on the virtual host definition. The following is the configuration lines for virtual host definition in order to inform Apache Webserver about how to access the web-based application :

 ServerName localhost.webapps.web ServerAdmin webmaster@localhost.webapps.web DocumentRoot /var/www/html/webapps DirectoryIndex index.html index.php Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted ErrorLog /var/www/html/webapps/logs/localhost.webapps.web-error.log CustomLog /var/www/html/webapps/logs/localhost.webapps.web-access.log combined 

As it is exist from the above line of configuration, there is a line as follows :

DirectoryIndex index.html index.php

The above line configuration means that index.html and index.php will be an index file in the root directory of the web-based application. So, the solution is simple. Just point of the root directory folder of the web-based application which contains the index.html or the index.php file. In the context of web-based application using Yii framework, it exist in the ‘web’ folder. So, change the DocumentRoot entry into the following line :

DocumentRoot /var/www/html/webapps/web

Make sure there is a file with the name of ‘index.html’ or ‘index.php’. Just check inside of the folder. Finally, don’t forget to restart the Apache Webserver’s service.

Читайте также:  Не работает alert javascript

Источник

[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.

Источник

Исправляем 403 Forbidden в Apache на CentOS

img

Маленькая, но полезная заметка. Однажда, в один прекрасный день у нас перестала работать подмапленная в 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). Профит!

Источник

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

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.

Источник

Оцените статью