Re: Comments on policy modifications
Here's what I've been doing... It saves a lot of space, especially
on the laptop.
--- from /etc/apache/srm.conf ------
# So I can gzip the html files in "/usr/doc"
AddType text/x-html-gzip htmlgz
AddHandler x-html-gzip htmlgz
Action x-html-gzip /cgi-bin/zcat-html
AddType text/x-plain-gzipped .gz
AddHandler x-plain-gzipped .gz
Action x-plain-gzipped /cgi-bin/zcat-plain
# ... or bzip2 them.
AddType text/x-html-bzip2 htmlbz2
AddHandler x-html-bzip2 htmlbz2
Action x-html-bzip2 /cgi-bin/bz2cat-html
AddType text/x-plain-bzip2ed .bz2
AddHandler x-plain-bzip2ed .bz2
Action x-plain-bzip2ed /cgi-bin/bz2cat-plain
--- from /etc/apache/access.conf -----
# Toplevel
RewriteLock "/var/run/mod_rewrite.lock"
RewriteLog "/var/log/apache/rewrite.log"
RewriteLogLevel 0
<Directory /usr/doc>
order allow,deny
allow from all
AllowOverride All
Options All
RewriteEngine on
RewriteBase /doc
RewriteOptions inherit
# If the file is here, then pass it on through unchanged.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [L]
# Does it exist in gzipped form?
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.*)\.html$ $1.htmlgz [L]
# ... or in bzip2ed form?
RewriteCond %{REQUEST_FILENAME}bz2 -f
RewriteRule ^(.*)\.html$ $1.htmlbz2 [L]
# ... or is the request for a shortnamed file?
RewriteCond %{REQUEST_FILENAME}l -f
RewriteRule ^(.*)\.htm$ $1.html [L]
# ... or is it a shortnamed file?
RewriteCond %{REQUEST_FILENAME}lgz -f
RewriteRule ^(.*)\.htm$ $1.htmlgz [L]
# ... or is it a shortnamed file?
RewriteCond %{REQUEST_FILENAME}lbz2 -f
RewriteRule ^(.*)\.htm$ $1.htmlbz2 [L]
</Directory>
--- /usr/lib/cgi-bin/zcat-html ----
#!/bin/bash
#
# Name this script: zcat-html, and then:
# for f in zcat-plain bz2cat-html bz2cat-plain; do ln -s zcat-html $f; done
#
if [ "${0##*/}" == "bz2cat-html" ]; then
echo Content-type: text/html
echo
cat "$PATH_TRANSLATED" | bunzip2
elif [ "${0##*/}" == "zcat-html" ]; then
echo Content-type: text/html
echo
zcat "$PATH_TRANSLATED"
elif [ "${0##*/}" == "zcat-plain" ]; then
echo Content-type: text/plain
echo
zcat "$PATH_TRANSLATED"
elif [ "${0##*/}" == "bz2cat-plain" ]; then
echo Content-type: text/plain
echo
cat "$PATH_TRANSLATED" | bunzip2
fi
--- /etc/cron.weekly/compress-html-in-usr-doc ---
#!/bin/bash
cd /usr/doc
umask 022
# Must prune off the /usr/doc/HTML directory so `dhelp' can still read its files.
# Also prune the Elvis directories.
for f in $(nice find /usr/doc -type d -name HTML -prune -or -name elvis -prune -or -type f -name '*.html' -print); do
nice gzip -9 ${f} && mv -f ${f}.gz ${f}gz
done
Reply to: