Pagespeed заметки

Общая: https://www.modpagespeed.com/

Установка на Nginx: https://modpagespeed.com/doc/build_ngx_pagespeed_from_source

Фильтры: https://www.modpagespeed.com/doc/config_filters#level

Nginx

# Основное домен для изображений
server {
  server_name domain.com;
}

При ImageRecompressionQuality = 50 % примеры для jpg
517 800 –> 156 949 Качество на странице сайта – плохое.

# Отдельный домен для изображений
server {

  server_name i.domain.com;

  # ВКЛЮЧАЕМ
  pagespeed on;

  # Путь к каталогу кэша 
  pagespeed FileCachePath /tmpfs/ngx_pagespeed_cache/i.domain.com/;

  # Максимальный размер кэша - 1ГБ
  pagespeed FileCacheSizeKb 1024000;

  # Интервал для очистки кэша - 7 дней
  pagespeed FileCacheCleanIntervalMs 650000000;

  pagespeed EnableFilters rewrite_images;
  pagespeed ImageRecompressionQuality 50;
  ...
}

Контроль

Добавляем к URL /?PageSpeedFilters=+debug 

В результирующем коде страницы смотрим:

<!--
mod_pagespeed on
Filters:
ah	Add Head
cw	Collapse Whitespace
cc	Combine Css
jc	Combine Javascript
gp	Convert Gif to Png
jp	Convert Jpeg to Progressive
jw	Convert Jpeg To Webp
mc	Convert Meta Tags
pj	Convert Png to Jpeg
ws	When converting images to WebP, prefer lossless conversions
db	Debug
ec	Cache Extend Css
ei	Cache Extend Images
es	Cache Extend Scripts
fc	Fallback Rewrite Css 
if	Flatten CSS Imports
hw	Flushes html
ci	Inline Css
ii	Inline Images
il	Inline @import to Link
ji	Inline Javascript
js	Jpeg Subsampling
rj	Recompress Jpeg
rp	Recompress Png
rw	Recompress Webp
rc	Remove Comments
ri	Resize Images
cf	Rewrite Css
jm	Rewrite External Javascript
jj	Rewrite Inline Javascript
cu	Rewrite Style Attributes With Url
cp	Strip Image Color Profiles
md	Strip Image Meta Data

Options:
AvoidRenamingIntrospectiveJavascript (aris) True
EnableRewriting (e) 1
FileCacheCleanIntervalMs (afcci) 1800000
FileCacheInodeLimit (afcl) 500000
FileCacheSizeKb (afc) 712000
RewriteLevel (l) Core Filters

#NumFlushes            2
#EndDocument after     36321us
#Total Parse duration  10397us
#Total Render duration 26180us
#Total Idle duration   3704us
Critical Images:
	https://i.domain.com/2015/05_13/11_46/files_topic_2_774.png
	https://i.domain.com/2015/05_13/11_49/files_topic_2_776.png
	https://i.domain.com/2015/05_13/11_50/files_topic_2_777.png
	https://i.domain.com/2015/05_13/11_52/files_topic_2_778.png
	https://i.domain.com/2015/05_13/11_52/files_topic_2_779.png
	https://i.domain.com/2015/05_13/11_53/files_topic_2_780.png
	https://i.domain.com/2015/05_19/00_37/files_topic_1_808.png
	https://i.domain.com/2015/06_01/19_42/files_topic_1_819.png
	https://i.domain.com/2015/09_18/17_37/files_topic_3_1195.png
	https://i.domain.com/2017/05_30/11_17/files_topic_3_3273.jpg
	https://i.domain.com/2017/09_01/15_18/files_topic_1_3375.jpg
The following filters were disabled for this request:
	SupportNoscript
-->