View previous topic :: View next topic |
Author |
Message |
epretorious Apprentice
Joined: 04 Jul 2003 Posts: 191 Location: Truckee, CA
|
Posted: Wed Jul 30, 2003 4:16 pm Post subject: Apache: serving gzip'd files |
|
|
I've been playing around with my freshly minted installation of Apache 1.3.27 and noticed that the contents of /usr/share/doc are available (http://localhost/doc/) but all of the documentation is gzip'd.
Is there any way to have Apache gunzip the files [on-the-fly] for display in the browser? _________________ Eric P.
Sunnyvale, CA |
|
Back to top |
|
|
devon l33t
Joined: 23 Jun 2003 Posts: 943
|
Posted: Wed Jul 30, 2003 5:18 pm Post subject: |
|
|
You would write a script that uses zcat to uncompress-and-cat the files. |
|
Back to top |
|
|
epretorious Apprentice
Joined: 04 Jul 2003 Posts: 191 Location: Truckee, CA
|
Posted: Thu Jul 31, 2003 3:47 pm Post subject: |
|
|
devon wrote: | You would write a script that uses zcat to uncompress-and-cat the files. |
Nah - There's got to be a way!
It would only make sense that Apache can decompress .gz files on the fly since mod_autoindex is configured (using the ReadmeName value) to append any README files at the end of directory indexes (if MultiViews and FancyIndexing are enabled) [u]and[\u] all of the README files in /usr/share/doc/ are gzip'd. _________________ Eric P.
Sunnyvale, CA |
|
Back to top |
|
|
uzik Apprentice
Joined: 17 Apr 2003 Posts: 257
|
Posted: Thu Jul 31, 2003 6:39 pm Post subject: |
|
|
I saw a configuration option that told apache to auto gunzip files
before sending them out. You just gzip your web pages and apache
takes care of the rest. Sorry I don't remember more about it. |
|
Back to top |
|
|
skunkworx Guru
Joined: 02 Feb 2003 Posts: 420 Location: Planet Houston
|
Posted: Tue Sep 30, 2003 8:41 pm Post subject: |
|
|
Dusting off an old thread here...
I came across this thread when looking to see if any Gentoo'ers had worked with this Apache module that is supposed to be able to serve gzipped content, unzipping it on the fly only to servers that need it. Might be useful if you're still looking for something. |
|
Back to top |
|
|
Jaminadi n00b
Joined: 24 Nov 2004 Posts: 24 Location: Boise, ID
|
Posted: Mon Sep 26, 2005 10:38 pm Post subject: Apache2 has Built in Solution |
|
|
Well, This is an old posting, but I wanted to browse my documents in /usr/share/doc
After a bit more research I found what most people already know. You can use a Ext filter in apache2 to do these.
For example, I wanted to convert .html.gz into .html. I added the following
Code: |
ExtFilterDefine gz-to-html mode=output \
intype=application/x-gzip-html outtype=text/html \
cmd="/bin/gunzip -c -"
AddType application/x-gzip-html .html.gz
|
To the httpd.conf and then I added the following to the same file in the directories that I wanted to serve with html.gz files.
Code: |
SetOutputFilter gz-to-html
|
Then you just restart your apache2 server and wala. It serves up the doc files from the .html.gz. I also added another type for plain .gz file that converted them to text because alot of the rest of the gz'ed files were text/plain type and had no extra extensions. _________________ A woman is as a sword laid aside or a fire at a distance. THe one does not burn, the other does not cut those that approach not neigh unto them. |
|
Back to top |
|
|
random-feed n00b
Joined: 12 May 2005 Posts: 20
|
Posted: Sat Oct 15, 2005 6:53 am Post subject: this used to work with apache2 before |
|
|
Sorry for digging up the ancient thread, but...
This is my problem exactly. I installed apache2 about 4 months ago, and browsing my /doc was not a problem, .gz files were opened in firefox as plain text without additional hacking of apache2.conf. However, I recently upgraded apache as described here. Guess what? The .gz files no longer displayed, firefox suggested to save them on my hard drive instead.
I have been looking at the files in the backup of my conf/ dir, tried applying some changes to httpd.conf, alas. I cannot get this to work, unles I follow Jaminadi's advice above. I know his way will work, but this used to be a generic feature.
Any ideas on this? Are there any modules that I need to load additionaly? What went wrong with .gz-ed text files and httpd? _________________ If in doubt, mumble. |
|
Back to top |
|
|
tecknojunky Veteran
Joined: 19 Oct 2002 Posts: 1937 Location: Montréal
|
Posted: Fri Oct 21, 2005 4:17 am Post subject: |
|
|
I'd love to do this (groking /usr/share/doc from my broswer), but without having to install Apache on my box. Since you can open local files with file:///, I was wondering if you could tell the browser (firefox for me) to autouncompress .txt.gz extention. Can it be done? _________________ (7 of 9) Installing star-trek/species-8.4.7.2::talax. |
|
Back to top |
|
|
random-feed n00b
Joined: 12 May 2005 Posts: 20
|
Posted: Thu Oct 27, 2005 8:42 pm Post subject: solved for me |
|
|
well, I need to browse the docs on my other box...
anyway, I found a way to make gzip-ed text to show as text in the browser without external filters. I commented out
Code: | #AddType application/x-gzip gz tgz
|
and left only:
Code: | AddEncoding x-gzip gz tgz
|
Thus, the server response became:
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Thu, 27 Oct 2005 20:41:33 GMT
Server: Apache
Last-Modified: Sun, 23 Oct 2005 23:33:12 GMT
ETag: "e928-82e-5478de00"
Accept-Ranges: bytes
Content-Length: 2094
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain; charset=ISO-8859-1
Content-Encoding: x-gzip
Length: 2,094 (2.0K) [text/plain]
This is sure to confuse browsers when serving gzip-ed binary files, but works without external filters. |
|
Back to top |
|
|
|