Я обнаружил, что мой сервер не обслуживает сжатые страницы.
С помощью этот ответ, Я добавил в свой файл httpd conf следующее:
# Declare a "gzip" filter, it should run after all internal filters like PHP or SSI
FilterDeclare gzip CONTENT_SET
# "gzip" filter can change "Content-Length", can not be used with range requests
FilterProtocol gzip change=yes;byteranges=no
# Enable "gzip" filter if "Content-Type" contains "text/html", "text/css" etc.
FilterProvider gzip DEFLATE resp=Content-Type $text/html
FilterProvider gzip DEFLATE resp=Content-Type $text/css
FilterProvider gzip DEFLATE resp=Content-Type $text/javascript
FilterProvider gzip DEFLATE resp=Content-Type $application/javascript
FilterProvider gzip DEFLATE resp=Content-Type $application/x-javascript
# Add "gzip" filter to the chain of filters
FilterChain gzip
Далее я выдал
apachectl configtest
что привело к этой ошибке:
Неверная команда "FilterDeclare", возможно, неправильно написана или определена модулем, не включенным в конфигурацию сервера.
Вот вывод из httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
Какие модули мне нужно установить, чтобы сжатие страниц работало? Я использую CentOS 6.6.
В Centos mod_filter
не загружаются по умолчанию, вам нужно добавить или раскомментировать httpd.conf
следующая строка:
LoadModule filter_module modules/mod_filter.so
Не забудьте перезагрузить изменения
service httpd graceful