1. 설치
cd apache_home/bin
./apxs -i -a -c /usr/local/src/httpd-2.2.8/modules/filters/mod_deflate.c
2. 설정
추가
LoadModule deflate_module modules/mod_deflate.so
<IfModule deflate_module>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml application/xml application/rss+xml
AddOutputFilterByType DEFLATE text/css application/javascript application/x-javascript
AddOutputFilterByType DEFLATE audio/midi
DeflateCompressionLevel 9
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote ratio
#LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate
# Netscape 4.x problem
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 problem
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# no-gzip
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|jpg|png|bmp|zip|tar|rar|alz|a00|ace|txt|mp3|mpe?g|wav|asf|wma|wmv|swf|exe|pdf|doc|xsl|hwp|java|c|t?gz|bz2|7z)$ no-gzip dont-vary
</IfModule>
아파치 재시작
3. 테스트
로그 확인
phpinfo();
HTTP Compression Test
4. 참고
http://httpd.apache.org/docs/2.2/mod/mod_deflate.html
'apache' 카테고리의 다른 글
Installing Apache 2.4.1 from source on CentOS 6.2 Linux (0) | 2012.07.10 |
---|---|
APM(apache 2.4.1) 설치시 문제 해결 (0) | 2012.07.10 |
[Ubuntu] Apache2.4.x 설치 (0) | 2012.07.10 |
아파치 mod_deflate로 압축 전송하기 (0) | 2012.02.16 |
[Apache] MPM(Prefork VS Worker) (0) | 2011.04.19 |