Recommended Apache configurations

# README: Web-based Help from DocBook XML
Using and customizing the output

Sidebar | Prev | Up | Next

### Recommended Apache configurations

If you are serving a long document from an Apache web server, we recommend you make the following additions or changes to your `httpd.conf` or `.htaccess` file. TODO: Explain what each thing does.

    AddDefaultCharSet UTF-8 #

          # 480 weeks
          <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> #
          Header set Cache-Control "max-age=290304000, public"
          </FilesMatch>

          # 2 DAYS
          <FilesMatch "\.(xml|txt)$">
          Header set Cache-Control "max-age=172800, public, must-revalidate"
          </FilesMatch>

          # 2 HOURS
          <FilesMatch "\.(html|htm)$">
          Header set Cache-Control "max-age=7200, must-revalidate"
          </FilesMatch>

          # compress text, html, javascript, css, xml:
          AddOutputFilterByType DEFLATE text/plain #
          AddOutputFilterByType DEFLATE text/html
          AddOutputFilterByType DEFLATE text/xml
          AddOutputFilterByType DEFLATE text/css
          AddOutputFilterByType DEFLATE application/xml
          AddOutputFilterByType DEFLATE application/xhtml+xml
          AddOutputFilterByType DEFLATE application/rss+xml
          AddOutputFilterByType DEFLATE application/javascript
          AddOutputFilterByType DEFLATE application/x-javascript

          # Or, compress certain file types by extension:
          <Files *.html>
          SetOutputFilter DEFLATE
          </Files>

| See Odd characters in HTML output in Bob Stayton's book DocBook XSL: The Complete Guide for more information about this setting.
| These lines and those that follow cause the browser to cache various resources such as bitmaps and JavaScript files. Note that caching JavaScript files could cause your users to have stale search indexes if you update your document since the search index is stored in JavaScript files.
| These lines cause the the server to compress html, css, and JavaScript files and the brower to uncompress them to improve download performance.

Prev | Up | Next
| Home |