Answer the question
In order to leave comments, you need to log in
Gzip or deflate and apache+nginx how to be?
I ran into a problem - Google requires (categorically requires) to enable Gzip or deflate compression. The apache + nginx bundle is installed on the hosting, therefore there is no way to enable it (as they explained to me in the cpp, they only suggested leaving Apache and working with it, but then the performance will drop). What is the best way to proceed in this case? I did not find any configuration guides for apache + nginx, the site is on wp.
UPD
Here is the server response (tested with Yandex):
Server: nginx
Date: Sat, 03 Dec 2016 07:29:14 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 12267
Connection: keep-alive
Keep-Alive: timeout=5
X-Powered-By: PHP/7.0.12
Cache-Control: max-age=0
Expires: Sat, 03 Dec 2016 07:29:14 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Answer the question
In order to leave comments, you need to log in
Conclusion how to be, mb is useful to someone (thanks to Ruslan for his contribution):
for wp:
# кеширование в браузере на стороне пользователя
<IfModule mod_expires.c>
#Включаем поддержку директивы Expires
ExpiresActive On
# Задаем время для хранения файлов (картинок) в кэше для каждого типа
ExpiresDefault "access 7 days"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/html "access plus 7 day"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
</IfModule>
# Cache-Control
<ifModule mod_headers.c>
# Задаем 30 дней для данного типа файла
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# Задаем 30 дней для данного типа файла
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# Задаем 2 дня для данного типа файла
<filesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>
# Задаем 1 день для данного типа файла
<filesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=172800, private, must-revalidate"
</filesMatch>
</ifModule>
# использование кеша браузеров
FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch ".(jpg|jpeg|gif|png|ico|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
#Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE
<IfModule mod_setenvif.c>
BrowserMatch "MSIE" force-no-vary
BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question