鉴于本版不少人问mod_gzip和mod_perl的配置问题,特发此贴
fzjw 2005-06-22 06:02:46 今天在自己机器上换了Apache 2.0.54,成功配置mod_gzip和mod_perl,分享一下经验 :)
Apache2吃内存太凶,比1.3.33厉害多了 -_-#
言归正传......
软件版本:
Apache2 : 2.0.54
Perl : 5.8.7
mod_perl : 2.0.1
mod_gzip : 2.0.50
1、mod_gzip 2.0.50
下载mod_gzip
for Apache1:
http://www.gknw.net/development/apache/apache-1.3/win32/modules/mod_gzip-1.3.19.1a-w32.zip
http://www.gknw.net/development/apache/apache-1.3/win32/modules/mod_gzip-1.3.19.2a-w32.zip
http://www.gknw.net/development/apache/apache-1.3/win32/modules/mod_gzip-1.3.26.1a-EAPI-w32.zip
http://www.gknw.net/development/apache/apache-1.3/win32/modules/mod_gzip-1.3.26.1a-w32.zip
for Apache2:
http://www.gknw.net/development/apache/httpd-2.0/win32/modules/mod_gzip-2.0.49-w32.zip
http://www.gknw.net/development/apache/httpd-2.0/win32/modules/mod_gzip-2.0.53-w32.zip
编辑httpd.conf:
LoadModule gzip_module modules/mog_gzip.so
AddModule mod_gzip.c (Apache2不需要这行)
<IfModule mod_gzip.c>
########################
### responsibilities ###
########################
# ---------------------------------------------------------------------
# use mod_gzip at all?
mod_gzip_on Yes
# (you can especially enable mod_gzip inside the central server
# configuration but disable it inside some directories ot virtual
# hosts by using this directive.)
# ---------------------------------------------------------------------
######################################
### statically precompressed files ###
######################################
# ---------------------------------------------------------------------
# let mod_gzip perform 'partial content negotiation'?
mod_gzip_can_negotiate Yes
# (if this option is active and a static file is to be served in com-
# pressed for, then mod_gzip will look for a static precompressed
# version of this file with a defined additional extension - see next
# directive - which would be delivered with priority. This would allow
# for avoiding to repeatedly compress the same static file and thus
# saving CPU time.
# No dynamic caching of this file is provided; currently the user
# himself is responsible for creating and updating the precompressed
# file's content.
# From version 1.3.19.2a mod_gzip automatically recognizes whether
# a statically precompressed file is older than its uncompressed
# original and in this case will serve the content of the original
# file in uncompressed form - as to rather serve correct data than
# outdated ones ...)
# ---------------------------------------------------------------------
# extension (suffix) for statically precompressed files
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
# (effect: see previous directive; this string will be appended to the
# name of the original file.
# be sure to configure the encoding 'gzip' for this extension as well,
# because mod_gzip doesn't serve the content itself but simply generates
# an Apache internal redirection to this URL. Therefore the remaining
# Apache configuration is responsible for setting the 'Content-Encoding'
# header properly ...
# prior to version 1.3.19.2a this value was not configurable.)
# ---------------------------------------------------------------------
# automatic updates for statically precompressed files
mod_gzip_update_static No
# (if set to 'Yes', this directive (being new in version 1.3.26.1a) would
# cause mod_gzip to automatically update an outdated version of any
# statically precompressed file during the request, i. e. compress the
# originally requested file and overwrite the precompressed variant
# file with it!
# for each automatic update of this type, mod_gzip will write a message
# of the severity 'notice' into the Apache error_log.
# while doing so, mod_gzip will directly read the original file's content.
# therefore this content cannot be interpreted by any other Apache module
# during the request. this might possibly not be what you want - hopefully
# it will be what most users want, because it works fast this way.
# use this configuration with a lot of care, and be sure that you don't
# inadvertantly cause valuable files within the URL tree to be overwritten.
# this isn't a feature to be used for mass hosting servers, especially
# because mod_gzip might experience access control problems there - the
# userid the Apache processes are running under need to have write access
# to the precompressed files of all users, which may not automatically be
# the case.)
# [mod_gzip error handling in this situation??? what will be served?]
# ---------------------------------------------------------------------
###################
### bureaucracy ###
###################
# ---------------------------------------------------------------------
# display status for mod_gzip
mod_gzip_command_version '/mod_gzip_status'
# (defines an URL to display the status of mod_gzip; can be specified
# individually for each installation and protected against access via
# <Location> section for privacy reasons)
# ---------------------------------------------------------------------
# The status display will look like this:
# mod_gzip is available...
# mod_gzip_version = 1.3.26.1a
# mod_gzip_on = Yes/No
# and thus will provide information about
# - mod_gzip being installed at the server and working correctly,
# - which version has been installed and
# - whether mod_gzip has been set 'active' for this Location
# (-> mod_gzip_on)
# ---------------------------------------------------------------------
#######################
### data management ###
#######################
# ---------------------------------------------------------------------
# Working directory for temporary files and the compression cache
# if not specified, the following default values are used:
# [Win32=c:\temp], [UNIX=/tmp]
# mod_gzip_temp_dir /tmp
# (This directory must already exist and the userid being used for
# running the Apache server must have read and write access to this
# directory.
# Unlike other Apache directives an absolute path name must be specified
# here; a relative value will not be interpreted relatively to ServerRoot.
# This pastname must NOT be terminated with '/'.
# For maximum performance this directory should be located on a RAM disk,
# if the file system isn't already being cached efficiently
# ---------------------------------------------------------------------
# Save temporary work files [Yes, No]
mod_gzip_keep_workfiles No
# (one file per HTTP request - set to 'yes' for debugging purpose only!)
# ---------------------------------------------------------------------