Has anyone here managed to get FancyIndexing working in Apache 2.4? - I have found plenty of guides, but they are all at least 5-9 years out of date and do not work with Apache 2.4.
According to the documentation, FancyIndexing comes under mod_autoindex (which is enabled by default), and all that is required to get it working on a most basic level is Options +Indexes in a directory block, like so:
<Directory "/var/www"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Require all granted </Directory>
The problem is that it is not working: if I have a blank index page...
# DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.htm </IfModule>
...the index page overrides the indexing, or:
# DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex disabled </IfModule>
...causes the default Apache placeholder webpage to be displayed, as does simply removing the index page.
I should also mention that what I am trying to achieve is an index view of my web-directory in order to avoid having to implement a mess of linked pages. - The website is intended as a resource site, so visitors can simply move directly to the page or the resouce that they want with no messing around. Also, at this point, FancyIndexing is not absolutely essential, as I should be able to 'upgrade' to that once I have indexing working.
This is additional to my comments, and is in further reply to Anaksunaman's answer, with my own notes and observations:
Find the LoadModule directive for autoindex_module in httpd.conf and make sure it is uncommented:
LoadModule autoindex_module modules/mod_autoindex.so
Yes, I included that, as can be seen below:
# Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # Include conf.modules.d/*.conf LoadModule autoindex_module modules/mod_autoindex.so
Make sure Indexes is added to your Options directive under the Directory block for your DocumentRoot. In your case, your Options directive appears fine e.g.:
Options Indexes FollowSymLinks
Not quite: there is (on Cent OS / RHEL / Red Hat / Fedora, at least) a nasty gotcha in the form of /etc/httpd/conf.d/welcome.conf. - The Options -Indexes entry needs to be amended to either Options Indexes or Options +Indexes, otherwise the indexing will not work and there will be a client denied by server configuration: /var/www type error in the log file.
In httpd-autoindex.conf, make sure:
Your IndexOptions directive has FancyIndexing listed e.g. IndexOptions FancyIndexing HTMLTable VersionSort.
Alias /icons/ is pointed at the correct directory for your icons e.g. Alias /icons/ "/path/to/Apache24/icons/"
The Directory block for your icon path uses the same path as Alias /icons/ e.g
This is no longer necessary, as it is all now pre-configured (for the basic indexing and fancy indexing, at least), with an IndexOptions block for the addition of further configuration options.