Search This Blog

20140223

Getting Doc-Central To Display Compressed Documentation as Text

This article has to do with Apache web server and the Doc-Central and Dwww documentation utilities for Linux. It is intended for experienced Linux users who are familiar with Apache, Doc-Central and Dwww.

Crunchbang Linux 11 comes with Apache2.

Today I installed dwww and Doc-Central so I can use Chrome to read documentation.

Dwww can read both plaintext README files and related files and the compressed changelog.gz, changelog.Debian.gz, NEWS.gz, and README.gz files. However, Doc-Central can only read plaintext files.

So the challenge was to get Doc-Central to display the GZipped documentation as plaintext on a web browser.

So I spent an hour researching the problem and came up with the following solution:

To set up Apache serve so that Doc-Central display so that changelog.gz, changelog.Debian.gz, NEWS.gz, and README.gz are displayed as text, change the mime.conf by uncommenting all the lines containing AddType.

Then change the alias.conf by adding the following text after the comments:

Alias /doc/ "/usr/share/doc/"

<directory "/usr/share/doc">
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all

AddEncoding gzip gz
<filesmatch "\.gz$">
ForceType text/plain
Header set Content-Encoding: gzip
</FilesMatch>
</Directory>

Finally, restart Apache using apache2ctl:
$ apache2ctl restart

It will take a few minutes for Apache to update Doc-Central.

When I checked Doc-Central again, the compressed text displayed as plaintext.

1 comment:

Sageb1 said...

Today, after much researching, I succeeded in doing the following with uncompressing of gzip files enabled:

Added username URL localhost/username as follows:

1) Make symbolic link to /home/username/htdocs:

$ ln -s /home/username/htdocs /var/www/username


2) added the following lines to alias.conf:

Alias /sageb1/ "/var/www/sageb1/"


Options Indexes
AllowOverride None
Order allow,deny
Allow from all

AddEncoding gzip gz
>FilesMatch "\.gz$">
ForceType text/plain
Header set Content-Encoding: gzip



Note: "username" == name of user in home directory e.g. replace "username" with the name of the user in the home directory.

E.g. if the username is "foo" then
the full path leading to the user's directory is "/home/foo/htdocs"