apache_conf gzip / deflate apache2
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf gzip / deflate apache2相关的知识,希望对你有一定的参考价值。
### Сжать ответ сервера для перечисленных MIME типов
<ifModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon
</ifModule>
</ifModule>
### Подсказать браузеру схему кеширования через заголовки в ответе сервера
<ifModule mod_headers.c>
# 43200 - день, 604800 - неделя, 2592000 - месяц
<FilesMatch "\.(html|js|css)$">
Header set Cache-Control "max-age=2592000"
#Header unset Last-Modified
</FilesMatch>
<Files *.txt>
Header add Cache-Control "max-age=43200"
</Files>
<FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
# отключить кэширование
Header unset Cache-Control
</FilesMatch>
</IfModule>
<IfModule mod_expires.c>
# Enable expires
ExpiresActive On
# Default a cache expiration
ExpiresDefault "access plus 10 month"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS, JavaScript
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
</IfModule>
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
以上是关于apache_conf gzip / deflate apache2的主要内容,如果未能解决你的问题,请参考以下文章
apache_conf .htaccess样板包括expire头,mod pagespeed,缓存控件头,Gzip,Deflate #htaccess #seo
apache_conf .htaccess样板包括expire头,mod pagespeed,缓存控件头,Gzip,Deflate #htaccess #seo
apache_conf 添加deflate支持(压缩)和htaccess
无法启用压缩(deflate/gzip)
GZIP 与 DEFLATE 压缩相比有啥优势?
gzip是一种数据格式,deflate是一种压缩算法