Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
fuss:apache [2017/02/22 18:30] – external edit 127.0.0.1fuss:apache [2020/11/14 12:36] – [Calculate the Optimal Maximum Number of Concurrent Connections] office
Line 360: Line 360:
 &\approx& 71  &\approx& 71 
 \end{eqnarray*} \end{eqnarray*}
 +
 +====== Implementing a Global and Consistent Directory Index Style ======
 +
 +The following setup implements a global and consistent directory index style that can be used for multiple virtual hosts just by adding an include to any ''Directory'' stanza within a virtual host configuration.
 +
 +<ditaa>
 ++ /
 +|
 ++---+ /etc/apache2/
 +|         +
 +|         |
 +|         +---+ conf-available/
 +|                   +
 +|                   |
 +|                   +---+ fancyindex.conf
 +|         
 +|         +---+ includes/
 +|                 +
 +|                 |
 +|                 +---+ fancyindex.conf
 +|         |
 +|         +---+ sites-available/
 +|                    +
 +|                    |
 +|                    +---+ vhost.conf
 +|          
 ++---+ /var/www/
 +         +
 +         |
 +         +---+ .fancyindex.css      
 +</ditaa>
 +
 +where:
 +  * ''/etc/apache2/conf-available/fancyindex.conf'' contains:
 +<code>
 +Alias "/fancyindex.css" "/var/www/.fancyindex.css
 +</code>
 +  * ''/etc/apache2/includes/fancyindex.conf'' contains:
 +<code>
 +IndexOptions +Charset=UTF-8
 +IndexOptions +TrackModified
 +IndexOptions +Charset=UTF-8
 +IndexOptions +FoldersFirst
 +IndexOptions +NameWidth=*
 +IndexOptions +FancyIndexing
 +IndexOptions +HTMLTable
 +IndexOptions +SuppressDescription
 +IndexIgnore favicon.ico
 +IndexIgnore auth*
 +IndexIgnore include*
 +IndexIgnore css*
 +IndexIgnore share*
 +IndexIgnore upload*
 +IndexIgnore incoming*
 +IndexStyleSheet "/fancyindex.css"
 +Options +Indexes
 +</code>
 +  * ''/etc/apache2/sites-available/vhost.conf'' is a virtual host configuration where the indexing can be turned on within any ''Directory'' stanza just by including ''/etc/apache2/includes/fancyindex.conf'', ie enabling directory indexing for the directory named ''path'' relative to the root of the virtual host:
 +<code>
 +    <Directory /path>
 +        include "includes/fancyindex.conf"
 +    </Directory>
 +</code>
 +  * ''/var/www/.fancyindex.css'' contains the following:
 +<code>
 +* {
 +    font-family: monospace;
 +}
 +</code>
 +and is responsible for setting the CSS for the rendered index page.
 +
 +<WRAP info>
 +''IndexStyleSheet'' takes an URL relative to the virtual host document root such that the aliasing performed within ''/etc/apache2/conf-available/fancyindex.conf'' redirects the requests to the default virtual host where the ''/var/www/.fancyindex.css'' file is placed. It ain't pretty, but it works; at least short of changing ''IndexStyleSheet'' itself! 
 +</WRAP>
 +
 +Perhaps a good reason for preferring this setup to using ''AllowOverride'' and ''.htaccess'' files is that the style of the directory index is generated by Apache itself rather than the website such that one can avoid mixing data with code. Furthermore, given multiple virtual hosts with the same owner, a consistent style may be preferred and with a centralized way of batch-changing all directory indexes.
 +
 +
 +

fuss/apache.txt · Last modified: 2022/09/17 22:36 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.