deflate模块配置:
去掉前面的井号,加载模块
LoadModule deflate_module modules/mod_deflate.so
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE #添加deflate压缩
DeflateCompressionLevel 7 #压缩级别
#设置压缩对象格式
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php text/css text/javascript
AddOutputFilter DEFLATE css
AddOutputFilter DEFLATE js
#设置日志输出!
DeflateFilterNote Input input_info
DeflateFilterNote Output output_info
DeflateFilterNote Ratio ratio_info
LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
CustomLog logs/deflate.log deflate
</IfModule>
mod_disk_cache模块配置:
加载模块
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
<IfModule mod_cache.c>
CacheDefaultExpire 3600 #设置默认缓存过期时间
<IfModule mod_disk_cache.c>
CacheEnable disk / #设置缓存内容,缓存路径
CacheRoot D:/server/apacheCache #设置缓存文件目录
CacheDirLevels 2 #缓存目录的深度
CacheDirLength 1 #缓存目录名的字符长度
#CacheMaxFileSize 1048576 #缓存文件的最大值和最小值
#CacheMinFileSize 10
</IfModule>
</IfModule>
mod_expires配置:
去掉前面的井号,加载模块
LoadModule expires_module modules/mod_expires.so
<IfModule mod_expires.c>
expiresactive on #启用expires功能
expiresdefault a60 #设置默认缓存时间为60秒
expiresbytype text/html a300 #设置不同类型文件缓存时间
expiresbytype text/plain a300
expiresbytype text/css a3600
expiresbytype application/x-javascript a3600
</IfModule>
apache监控模块:
去掉前面的井号,加载模块
LoadModule status_module modules/mod_status.so
<location /server-status>
SetHandler server-status #开启监控模块
Order Deny,Allow
Deny from all
Allow from all
</location>