라이믹스에서는 압축 전송이 기본으로 있지만, XE에는 아직 없습니다만,
제가 사용하는 호스팅에서 cpanel에서는 압축 전송 기능이 따로 있더군요.
Compress Content
Apache 2.0 and 2.2 allow you to compress content before sending it to the visitor’s browser. The types of content to be compressed are specified by MIME type. This feature requires Apache’s mod_deflate to function correctly.
설명을 보면, 아파치의 mod_deflate가 설정되어있어야 한다고 하는데요,
http://watchclone.kr/phpinfo.php
해당 사이트의 phpinfo 정보를 살펴보면, 해당 모듈이.. deflate 로 검색해보면 있는데 저게 맞는지
호스팅 채팅으로 문의해보니, 기본으로 설정되어있다면서..
아래 주소를 알려주더군요..
https://www.a2hosting.com/kb/developer-corner/apache-web-server/data-compression-using-the-mod-deflate-module
사용하는 방법인데요,
제가 따로 검색해서 아래 사이트를 찾았는데
http://pat.im/863
이 사이트에서는 알려주길, 아래와 같이 작성해주면 된다고 해서 해당 부분을 입력해줬는데..
<IfModule mod_deflate>
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 audio/midi
DeflateCompressionLevel 9
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에는 그대로 압축해서 보냄
</ifModule>
http://watchclone.kr/layouts/plain/css/layout.css?20160114155529
아직도 css는 압축이 된 것 같이 보이지는 않아서요. (__)a;;
혹시 제가 뭐 잘못한 부분이 있는지요...
htaccess 파일 원본
<IfModule mod_deflate.c> SetOutputFilter DEFLATE <IfModule mod_setenvif.c> # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary </IfModule> <IfModule mod_headers.c> # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </IfModule> </IfModule>
저 블로그 글도 잘 안되는거 같아서 다시 수정해본 htaccess 파일
<IfModule mod_deflate.c> SetOutputFilter DEFLATE <IfModule mod_setenvif.c> # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary </IfModule> <IfModule mod_headers.c> # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary <filesMatch "\.(js|css|html|php)$"> SetOutputFilter DEFLATE </filesMatch> </IfModule> </IfModule>
# 빠른 라이믹스 커뮤니티용 호스팅을 찾고 계신가요? >>>> 이온디호스팅 서비스는 PHP8 & Redis 서버 캐시를 활용하여 라이믹스에 최적화된 호스팅 서비스를 제공해드립니다. (서버세팅시 웹패널, 내도메인메일서비스도 함께 구축해드립니다.)
https://eond.com
댓글 5
아마 모듈단위에서 XE의 압축로드를 인식 못하고 잇는것 같아요.
사실상 XE에 해당 모듈을 사용하는 코드가 없어서리.. ㅠ
http://www.whatsmyip.org/http-compression-test/?url=aHR0cDovL3dhdGNoY2xvbmUua3I=
통과는 뜨는듯한데요..
XE의 js와 css 파일 등은 압축하지 않았지만 어쨌든 뭔가 압축은 해서 보낸다니-_-;;;
minify한 것을 다시 gzip하면 더 좋아요.
근데 아파치는 지저분한 설정이 많이 필요한 모양이네요. nginx는 그냥 gzip on; 하면 되는데... ㅋ