Home php教程 php手册 使用mod_gzip加速你的html页面

使用mod_gzip加速你的html页面

Jun 21, 2016 am 08:58 AM
file gzip include mod

页面

mod_gzip是一个可以加速html页面的程序,以apache的模块方式工作,你可以在http://www.remotecommunications.com得到

确定你的apache可以使用DSO方式安装模块。
首先解压缩并把补丁复制到临时目录中
# tar zxvf mod*z -C /tmp
# cp *tch /tmp
先打补丁
# cd /tmp/mod*a
# patch <..>然后就可以编译了
# make APXS=/path/to/apxs
安装:
# make install APXS=/path/to/apxs

修改apache的配置文件。
# cd /path/to/apache/conf
# cp httpd.conf httpd.conf.bak
用你喜欢的文本编辑程序,修改httpd.conf
要把下面两行去掉注释
LoadModule gzip_module libexec/mod_gzip.so
AddModule mod_gzip.c

然后在结尾添加如下配置:
# MOD_GZIP configuration
mod_gzip_on Yes
mod_gzip_minimum_file_size 1002
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 60000
mod_gzip_item_include mime "application/x-httpd-php"
mod_gzip_item_include mime text/*
mod_gzip_item_include mime "httpd/unix-directory"
mod_gzip_dechunk Yes
mod_gzip_temp_dir "/tmp"
mod_gzip_keep_workfiles No
mod_gzip_item_include file ".php3$"
mod_gzip_item_include file ".php$"
mod_gzip_item_include file ".txt$"
mod_gzip_item_include file ".html$"
mod_gzip_item_include file ".shtml$"
mod_gzip_item_exclude file ".css$"
mod_gzip_item_exclude file ".js$"

#更多想用gzip压缩的文件格式....

然后就可以启动了:
# /path/to/apache/bin/apachectl restart
如果发现有错误,根据提示重新修改httpd.conf。



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to uninstall/delete MOD in OpenIV How to uninstall/delete MOD in OpenIV Feb 18, 2024 pm 04:25 PM

How to uninstall/delete MOD in OpenIV

Cyberpunk 2077 sees up to a 40% performance boost with new optimized path tracing mod Cyberpunk 2077 sees up to a 40% performance boost with new optimized path tracing mod Aug 10, 2024 pm 09:45 PM

Cyberpunk 2077 sees up to a 40% performance boost with new optimized path tracing mod

Hongmeng native application random poetry Hongmeng native application random poetry Feb 19, 2024 pm 01:36 PM

Hongmeng native application random poetry

Use java's File.length() function to get the size of the file Use java's File.length() function to get the size of the file Jul 24, 2023 am 08:36 AM

Use java's File.length() function to get the size of the file

How to convert php blob to file How to convert php blob to file Mar 16, 2023 am 10:47 AM

How to convert php blob to file

Rabbit R1 gets modded to run games, performs better than expected Rabbit R1 gets modded to run games, performs better than expected Jun 29, 2024 am 07:50 AM

Rabbit R1 gets modded to run games, performs better than expected

Rename files using java's File.renameTo() function Rename files using java's File.renameTo() function Jul 25, 2023 pm 03:45 PM

Rename files using java's File.renameTo() function

How to set up Gzip compression for Nginx performance optimization How to set up Gzip compression for Nginx performance optimization May 29, 2023 pm 05:40 PM

How to set up Gzip compression for Nginx performance optimization

See all articles