참고 자료 : http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html
1. HTTP header를 이용하여 브라우저쪽에 데이터를 저장하는 캐쉬 -mod_expires, mod_header, mod_deflate
2. 데이터를 아파치가 있는 서버단에 저장하는 캐쉬 : mod_cache
# ------------------------------------------------------------------------------## .htaccess# Curtousy of the Magento Support Center# http://magentosupport.help/what-are-expires-headers-and-how-do-i-implement-them/## ------------------------------------------------------------------------------# ------------------------------------------------------------------------------# | Mod Caching via Apache |# ------------------------------------------------------------------------------<IfModule mod_cache.c><IfModule mod_mem_cache.c>CacheEnable mem /MCacheSize 4096MCacheMaxObjectCount 100MCacheMinObjectSize 1MCacheMaxObjectSize 2048</IfModule></IfModule># ------------------------------------------------------------------------------# | Proper MIME types for all files |# ------------------------------------------------------------------------------<IfModule mod_mime.c># AudioAddType audio/mp4 m4a f4a f4bAddType audio/ogg oga ogg# JavaScript# Normalize to standard type (it's sniffed in IE anyways):# http://tools.ietf.org/html/rfc4329#section-7.2AddType application/javascript js jsonpAddType application/json json# VideoAddType video/mp4 mp4 m4v f4v f4pAddType video/ogg ogvAddType video/webm webmAddType video/x-flv flv# Web fontsAddType application/font-woff woffAddType application/vnd.ms-fontobject eot# Browsers usually ignore the font MIME types and sniff the content,# however, Chrome shows a warning if other MIME types are used for the# following fonts.AddType application/x-font-ttf ttc ttfAddType font/opentype otf# Make SVGZ fonts work on iPad:# https://twitter.com/FontSquirrel/status/14855840545AddType image/svg+xml svg svgzAddEncoding gzip svgz# OtherAddType application/octet-stream safariextzAddType application/x-chrome-extension crxAddType application/x-opera-extension oexAddType application/x-shockwave-flash swfAddType application/x-web-app-manifest+json webappAddType application/x-xpinstall xpiAddType application/xml atom rdf rss xmlAddType image/webp webpAddType image/x-icon icoAddType text/cache-manifest appcache manifestAddType text/vtt vttAddType text/x-component htcAddType text/x-vcard vcf</IfModule># ------------------------------------------------------------------------------# | ETag removal |# ------------------------------------------------------------------------------# Since we're sending far-future expires headers (see below), ETags can# be removed: http://developer.yahoo.com/performance/rules.html#etags.# `FileETag None` is not enough for every server.<IfModule mod_headers.c>Header unset ETag<filesMatch "\.(ico|jpe?g|png|gif|swf)$">Header set Cache-Control "max-age=2592000, public"</filesMatch><filesMatch "\.(css)$">Header set Cache-Control "max-age=604800, public"</filesMatch><filesMatch "\.(js)$">Header set Cache-Control "max-age=216000, private"</filesMatch><filesMatch "\.(x?html?|php)$">Header set Cache-Control "max-age=600, private, must-revalidate"</filesMatch></IfModule>FileETag None# ------------------------------------------------------------------------------# | Expires headers (for better cache control) |# ------------------------------------------------------------------------------# The following expires headers are set pretty far in the future. If you don't# control versioning with filename-based cache busting, consider lowering the# cache time for resources like CSS and JS to something like 1 week.<IfModule mod_expires.c>ExpiresActive onExpiresDefault "access plus 1 month"# CSSExpiresByType text/css "access plus 1 year"# Data interchangeExpiresByType application/json "access plus 0 seconds"ExpiresByType application/xml "access plus 0 seconds"ExpiresByType text/xml "access plus 0 seconds"# Favicon (cannot be renamed!)ExpiresByType image/x-icon "access plus 1 week"# HTML components (HTCs)ExpiresByType text/x-component "access plus 1 month"# HTMLExpiresByType text/html "access plus 0 seconds"# JavaScriptExpiresByType application/javascript "access plus 1 year"# Manifest filesExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"ExpiresByType text/cache-manifest "access plus 0 seconds"# MediaExpiresByType audio/ogg "access plus 1 month"ExpiresByType image/gif "access plus 1 month"ExpiresByType image/jpeg "access plus 1 month"ExpiresByType image/png "access plus 1 month"ExpiresByType video/mp4 "access plus 1 month"ExpiresByType video/ogg "access plus 1 month"ExpiresByType video/webm "access plus 1 month"# Web feedsExpiresByType application/atom+xml "access plus 1 hour"ExpiresByType application/rss+xml "access plus 1 hour"# Web fontsExpiresByType application/font-woff "access plus 1 month"ExpiresByType application/vnd.ms-fontobject "access plus 1 month"ExpiresByType application/x-font-ttf "access plus 1 month"ExpiresByType font/opentype "access plus 1 month"ExpiresByType image/svg+xml "access plus 1 month"</IfModule><IfModule mod_deflate.c>############################################## enable apache served files compression## http://developer.yahoo.com/performance/rules.html#gzip# Insert filter on all contentSetOutputFilter DEFLATE# Insert filter on selected content types onlyAddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript# Netscape 4.x has some problems...BrowserMatch ^Mozilla/4 gzip-only-text/html# Netscape 4.06-4.08 have some more problemsBrowserMatch ^Mozilla/4\.0[678] no-gzip# MSIE masquerades as Netscape, but it is fineBrowserMatch \bMSIE !no-gzip !gzip-only-text/html# Don't compress imagesSetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary# Make sure proxies don't deliver the wrong contentHeader append Vary User-Agent env=!dont-vary</IfModule># ------------------------------------------------------------------------------# | GZip Compression (for faster page transfers) |# ------------------------------------------------------------------------------# GZip Compression# compress text, html, javascript, css, xml:#<IfModule mod_deflate.c>AddOutputFilterByType DEFLATE text/plainAddOutputFilterByType DEFLATE text/htmlAddOutputFilterByType DEFLATE text/xmlAddOutputFilterByType DEFLATE text/cssAddOutputFilterByType DEFLATE application/xmlAddOutputFilterByType DEFLATE application/xhtml+xmlAddOutputFilterByType DEFLATE application/rss+xmlAddOutputFilterByType DEFLATE application/javascriptAddOutputFilterByType DEFLATE application/x-javascript</IfModule># Limit bandwidth consumption<IfModule mod_php5.c>php_value zlib.output_compression 16386</IfModule>
'백엔드 > WAS' 카테고리의 다른 글
아파치+톰캣 SSL 환경 구축 (0) | 2019.09.15 |
---|---|
톰캣에서 애플리케이션 두번 디플로이 되는 현상 (0) | 2019.07.29 |
Apache + Tomcat 연동 맛보기 (0) | 2019.03.12 |
Squid Proxy Server (0) | 2015.06.21 |
JBoss AS7 시작하기 (2) | 2013.02.13 |
아파치 구동에러 (2) | 2010.02.09 |
Tomcat 구동시 및 중지시 apr 관련 경고 메세지 없애기. (0) | 2009.10.23 |
JBoss 에서 큐브리드 맛보기 (1) | 2009.07.31 |
댓글