Skip to content
조회 수 1351 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

아파치 모듈 mod_deflate 압축하기

 
gzip을 통한 신시간 압축 전송은 한정된 전송량을 알차게 쓰는 길이 되곤 한다.
압축하는 과정이 서버에게는 짐이지만, 전송할 내용이 줄어든 만큼 전송시간이 줄어들어
오히려 서버의 짐을 덜 수 있다.
 
 
 
httpd.conf의 전체 설정 또는 개별 가상 호스트(Virtual Host)나  .htaccess 파일의 적당한 곳에 다음과 같은 내용을 끼워 넣는다.
 
 
mod_deflate 모듈은 서버의 출력을 네트웍으로 클라이언트에 보내기 전에 압축하는 DEFLATE 출력필터를 제공한다.
 
 

일부 type만 압축

 

AddOutputFilterByType DEFLATE text/html text/plain text/xml 

 

 

 

 

이미지를 제외한 모든 것을 압축
 
<Location />
# 필터를 추가한다
SetOutputFilter DEFLATE
 
# Netscape 4.x에 문제가 있다...
BrowserMatch ^Mozilla/4 gzip-only-text/html
 
# Netscape 4.06-4.08에 더 문제가 있다
BrowserMatch ^Mozilla/4\.0[678] no-gzip
 
# MSIE은 Netscape라고 자신을 알리지만, 문제가 없다
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html          
 
# 주의: 아파치 2.0.48까지 mod_setenvif의 버그때문에
# 위의 정규표현식은 동작하지 않는다. 원하는 효과를
# 얻기위해 다음과 같이 수정하여 사용한다:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
 
# 이미지를 압축하지 않는다
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
 
# 프록시가 잘못된 내용을 전달하지않도록 한다
Header append Vary User-Agent env=!dont-vary

</Location> 

 

<IfModule mod_deflate.c>
AddType text/html .html .htm
AddType text/css  .css
AddType application/xml .xml
AddType application/javascript  .js
AddType application/x-httpd-php .php .php3 .html .htm .phtml .inc
AddType application/x-httpd-php-source .phps


AddOutputFilterByType DEFLATE text/plain text/html text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml application/xml application/rss+xml
AddOutputFilterByType DEFLATE text/css application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/php
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp

DeflateCompressionLevel 9          #사용할 압축레벨을 선택, 값이 클수록 압축률이 증가하지만, CPU를 더 많이 사용함

 

BrowserMatch ^Mozilla/4 gzip-only-text/html                # Netscape 4.xx에는 HTML만 압축해서 보냄
BrowserMatch ^Mozilla/4\.0[678] no-gzip                   # Netscape 4.06~4.08에는 압축해서 보내지 않음
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html     # 자신을 Mozilla로 알리는 MSIE에는 그대로 압축해서 보냄


압축하지 않을 파일들을 지정

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|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> 
 
 
 
로그인 후 댓글쓰기가 가능합니다.

?
  • ?
    Progress 2016.03.17 11:45
    http://www.comcbt.com/xe/comtip/1923377

List of Articles
번호 분류 제목 날짜 조회 수
157 컴퓨터잡담 PHP로 그림에 글자 입히기 2009.10.17 19996
156 컴퓨터잡담 윈도우7 인터넷 속도 제한 해제(윈도우7 QOS 설정) 30 2012.02.29 20006
155 Visual C++ IOStream 함수 13 2011.01.29 20026
154 컴퓨터잡담 엑셀 - 초과 근무시간 계산 3 2010.07.14 20084
153 파이썬 파이썬 구글스프레드시트 값 불러오기 html로 변환작업 중! 2022.05.08 20186
152 컴퓨터잡담 ExCEL VBA) 중복된 데이터 추출하기 4 2011.09.25 20196
151 컴퓨터잡담 동영상 제작프로그램, 파워디렉터(POWER DIRECTOR) 1 2 2010.09.10 20214
150 컴퓨터잡담 ExCEL VBA) 파일을 열지않고 값 읽어오기 23 2011.09.25 20215
149 AutoHotKey [AHK_B&AHK_L] 엑셀 제어 비교. 2 2011.08.02 20252
148 AutoHotKey ahk와 ahk_l 의 웹페이지 로딩완료 체크 비교 3 2011.02.11 20324
147 컴퓨터잡담 Tips N Tricks Process Listing - Using third party DLL! 2010.08.14 20425
146 AutoHotKey OnMessage() 3 2011.02.05 20463
145 컴퓨터잡담 [DOS모드] ftp 자동 전송기능, 도스배치명령으로 FTP 사용하기 1 2010.01.24 20523
144 컴퓨터잡담 autohotkey 변수의 이해 2010.10.02 20631
143 Server Google Chart API 이용하기 11 file 2013.04.10 20868
142 컴퓨터잡담 Windows Firewall/Internet Connection Sharing (ICS) 서비스를 시작할 수 없습니다. 4 2010.06.19 20955
141 컴퓨터잡담 시스템은 멀쩡한데 느닷없이 mysql 접속거부의 이유는 max_connect_errors과의 연관성 2 2010.05.06 20965
140 컴퓨터잡담 PHP 시간관련 함수 2 4 2009.08.06 21208
139 AutoHotKey IE.ahk COM 환상강의 1 file 2011.02.10 21252
138 컴퓨터잡담 AutohotKey Postmessage(SendMessage)로 CTRL+C 전송하기 2010.07.11 21413
Board Pagination Prev 1 ... 37 38 39 40 41 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소