This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fuss:apache [2017/02/22 18:30] – external edit 127.0.0.1 | fuss:apache [2022/09/17 22:36] (current) – [Globally Enable brotli Compression] office | ||
---|---|---|---|
Line 360: | Line 360: | ||
& | & | ||
\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 '' | ||
+ | |||
+ | < | ||
+ | + / | ||
+ | | | ||
+ | +---+ / | ||
+ | | + | ||
+ | | | | ||
+ | | +---+ conf-available/ | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | | +---+ includes/ | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | | | | ||
+ | | +---+ sites-available/ | ||
+ | | + | ||
+ | | | | ||
+ | | +---+ vhost.conf | ||
+ | | | ||
+ | +---+ /var/www/ | ||
+ | + | ||
+ | | | ||
+ | +---+ .fancyindex.css | ||
+ | </ | ||
+ | |||
+ | where: | ||
+ | * ''/ | ||
+ | < | ||
+ | Alias "/ | ||
+ | </ | ||
+ | * ''/ | ||
+ | < | ||
+ | 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 "/ | ||
+ | Options +Indexes | ||
+ | </ | ||
+ | * ''/ | ||
+ | < | ||
+ | < | ||
+ | include " | ||
+ | </ | ||
+ | </ | ||
+ | * ''/ | ||
+ | < | ||
+ | * { | ||
+ | font-family: | ||
+ | } | ||
+ | </ | ||
+ | and is responsible for setting the CSS for the rendered index page. | ||
+ | |||
+ | <WRAP info> | ||
+ | '' | ||
+ | </ | ||
+ | |||
+ | Perhaps a good reason for preferring this setup to using '' | ||
+ | |||
+ | ====== Globally Enable brotli Compression ====== | ||
+ | |||
+ | On Debian, to enable brotli compression, | ||
+ | <code bash> | ||
+ | apt-get install brotli | ||
+ | </ | ||
+ | |||
+ | and then the Apache module must be enabled by issuing the command: | ||
+ | <code bash> | ||
+ | a2enmod brotli | ||
+ | </ | ||
+ | |||
+ | Lastly, create the file ''/ | ||
+ | < | ||
+ | < | ||
+ | AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | The purpose of this file is to instruct the brotli Apache module to compress certain resources, namely textual content as well as javascript with the brotli compressor. | ||
+ | |||
+ | Finally, enable the configuration file by issuing the command: | ||
+ | <code bash> | ||
+ | a2enconf brotli | ||
+ | </ | ||
+ | |||
+ | and reload the Apache configuration: | ||
+ | <code bash> | ||
+ | systemctl apache2 reload | ||
+ | </ | ||
+ | |||
+ | The brotli compressor should now be enabled and will globally compress content as it is transferred from the Apache server. | ||
+ | |||
+ | Note that an alternative configuration is to add the contents of the file ''/ | ||
+ | |||
+ | |||
+ |