No matching DirectoryIndex (index.html,index.php)

Nethserver version : 7.3.1611
Module : nethserver-virtualhosts

I’m playing with awstats and I find something strange, for now it is a support post, but It might be probably a bug

When you create a virtualhost by the panel, you cannot browse the content even it the ‘Options +Indexes’ is set in the relevant apache virtualhost setting(/etc/httpd/conf.d/virtualhosts.conf), the default nethserver welcome page is displayed.

In the log you can find an error

[Tue May 09 19:04:25.214037 2017] [autoindex:error] [pid 25066] [client] AH01276: Cannot serve directory /var/lib/nethserver/vhost/ No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

of course if you put an index.html in /var/lib/nethserver/vhosts/toto then your specific index.html is displayed, but In some case you want to display a list of files and folders, hence my interest.

If you want to do it, then you must remove the line in /etc/httpd/conf.d/welcome.conf

-          Options -Indexes
+   #    Options -Indexes

the full code is

<LocationMatch "^/+$">
   Options -Indexes
    ErrorDocument 403 /.noindex.html
1 Like

Did you try by uploading an .htaccess file to the vhost web root?

Maybe it is AllowOverride’d

No I did not test the .htaccess…just looked the documentation before to write and It was not advised

bug or feature ?

It depends on the patch diff :grin:

I hope it is a matter of documenting a good procedure to achieve what you want. Please give .htaccess a try! I like the default splash page :wink:

I will do, but something that doesn’t work out of the box is a bug


You know, I don’t agree :smirk:

[root@NS7DEV9 ~]# cat /var/lib/nethserver/vhost/
Options +Indexes

the permissions are

[root@NS7DEV9 ~]# ls -la /var/lib/nethserver/vhost/
total 8
drwxr-sr-x 2 ftp  apache 33 May  9 22:41 .
drwxr-xr-x 3 root root   26 May  9 16:26 ..
-rw-r--r-- 1 root apache 17 May  9 22:39 .htaccess
-rw-r--r-- 1 root apache 19 May  9 19:04 tutu

then restart apache

[root@NS7DEV9 ~]# systemctl restart httpd

the default welcome page is still displayed and the error is still present in httpd error log

[Tue May 09 22:44:55.372294 2017] [autoindex:error] [pid 25806] [client] AH01276: Cannot serve directory /var/lib/nethserver/vhost/ No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive

what I missed ?

It’s not so easy…

The Location stanza in welcome.conf has probably higher priority! We need to override it in .htaccess, too…

More info

Don’t get me wrong, but you’re saying us the same thing M$ is telling us since ages…
“It’s not a bug, it’s an undocumented feature (even if it doesn’t work or doesn’t do what it’s expected to do)”

Steph is right… If something doesn’t work out of the box how it’s expected to work, it’s a bug… A coding one or a documentation one maybe, but still a bug

1 Like

This is a virtual-host specific configuration:

Create .htaccess in virtual host web root with the following content

Options +FollowSymLinks

    Options +Indexes

I’ve just applied it to !

The If directive is evaluated after Location. I used it because Location is not allowed in .htaccess files.

I’m not an expert in .htaccess, I do prefer to change the settings directly in apache…For what I know a .htaccess is the way to change some (not all) apache settings for less privileged users, so clearly it is a workaround but it doesn’t solve the root of the issue.

However thank to bring it up.

I don’t get the point to forbid all ‘+Indexes’ in the welcome.conf and to allow them in the VH configuration maybe you can en-light me. However I think that more apache directives worth a panel with check boxes…but really not a configuration file like a .htaccess.

NS is a shell-less OS :slight_smile:

I’m not an expert too, I constantly refer to apache docs and online forums!

I think I don’t catch what is the root of the issue… What do you mean?

First of all, welcome.conf is an upstream configuration file. I think its behavior is a good default for empty web sites. Moreover the virtual-host package is primarily for site hosting and no more intended for file sharing.

Most webapp tarballs come with an .htaccess configuration designed around upstream defaults. No need to write one (hopefully).

A custom .htaccess can be uploaded via FTP or SFTP. No shell programming is required.

Now, our UI is task oriented. IMO it’s hard to design a one-fit-all UI for the many Apache settings, the risk is programming a webmin-like interface. For this reason I’m not planning additional options for the UI at this moment.

However if we discover a common use case, good for the UI, we can surely discuss it!

Furthermore, if you like to develop an add-on UI I will be glad to help and improve the plugin support of this module!

simply to display the files/folders in the apache folder without a workaround…I saw many posts on this forum, people display the same welcome page for all Vhosts, until they put an index.html file (or install a web application)

did you think about the software repositories, you need to follow symlinks and display files/folders.

1 Like

OK, now it’s clearer, thanks for the clarification!

It could be a common use case, at least for mirrors maintainers, like you and me! Yes, it could deserve a checkbox…

I’d like to hear other opinions, too!

1 Like

Still my opinion with a user case. I play in a linux user group and the documents that we make, are available in an apache directory that we populate by ftp. It is available to the whole word.

Simple and efficient to share documents

1 Like

Even if the landing page is the default behavior of Apache con CentOS, I’d like to have an option to enable directory listing inside virtual hosts.

I think it could ease the life of users :slight_smile:


so @davidep and @giacomo what it can be done to solve this ‘new feature request’ or this nearly hidden bug


A pull request? :wink:

How would you implement it?

not yet thought, the landing nethserver page is predominant, @giacomo an idea ?

got something workable

add in 80/443 virtualhost

<LocationMatch "^/+$">
Options Indexes

then the default welcome page is no more displayed, you can browse the web folder. Of course it concerns only the virtualhost with this setting.