Last active
September 8, 2019 12:41
-
-
Save zdev0x/7026135ed4a531cde55885d8e9e66a9a to your computer and use it in GitHub Desktop.
ngx_page_speed.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # on 启用,off 关闭 | |
| pagespeed on; | |
| # 重置 http Vary 头 | |
| pagespeed RespectVary on; | |
| # html字符转小写 | |
| pagespeed LowercaseHtmlNames on; | |
| # 压缩带 Cache-Control: no-transform 标记的资源 | |
| pagespeed DisableRewriteOnNoTransform off; | |
| # 相对URL | |
| pagespeed PreserveUrlRelativity on; | |
| # 开启 https | |
| pagespeed FetchHttps enable; | |
| # 配置服务器缓存位置和自动清除触发条件,缓存文件夹如果不存在则需要自行创建,建议放在内存中 | |
| pagespeed FileCachePath "/var/cache/ngx_pagespeed/"; | |
| # pagespeed FileCachePath "/dev/shm/ngx_pagespeed/"; | |
| pagespeed FileCacheSizeKb 2048000; # 2GB | |
| pagespeed FileCacheCleanIntervalMs 43200000; | |
| pagespeed FileCacheInodeLimit 500000; | |
| # 过滤规则 | |
| pagespeed RewriteLevel PassThrough; | |
| # 移除 html 空白 | |
| pagespeed EnableFilters collapse_whitespace; | |
| # 移除 html 注释 | |
| pagespeed EnableFilters remove_comments; | |
| # DNS 预加载 | |
| pagespeed EnableFilters insert_dns_prefetch; | |
| # 压缩CSS | |
| pagespeed EnableFilters rewrite_css; | |
| # 合并CSS | |
| pagespeed EnableFilters combine_css; | |
| # 重写CSS,优化加载渲染页面的CSS规则 | |
| pagespeed EnableFilters prioritize_critical_css; | |
| # 压缩js | |
| pagespeed EnableFilters rewrite_javascript; | |
| # 合并js | |
| pagespeed EnableFilters combine_javascript; | |
| # 优化内嵌样式属性 | |
| pagespeed EnableFilters rewrite_style_attributes; | |
| # 压缩图片 | |
| pagespeed EnableFilters rewrite_images; | |
| # 不加载显示区域以外的图片 | |
| pagespeed LazyloadImagesAfterOnload on; | |
| # 图片预加载 | |
| pagespeed EnableFilters inline_preview_images; | |
| # 移动端图片自适应重置 | |
| pagespeed EnableFilters resize_mobile_images; | |
| # 图片延迟加载 | |
| pagespeed EnableFilters lazyload_images; | |
| # 扩展缓存 改善页面资源的可缓存性 | |
| pagespeed EnableFilters extend_cache; | |
| # 图片转换 | |
| pagespeed EnableFilters convert_gif_to_png,convert_png_to_jpeg,convert_jpeg_to_webp; | |
| pagespeed EnableFilters convert_jpeg_to_progressive; | |
| pagespeed EnableFilters convert_to_webp_animated; | |
| pagespeed EnableFilters flatten_css_imports; | |
| pagespeed EnableFilters outline_css; | |
| pagespeed EnableFilters move_css_to_head; | |
| pagespeed EnableFilters sprite_images; | |
| pagespeed EnableFilters resize_images; | |
| pagespeed EnableFilters elide_attributes; | |
| pagespeed EnableFilters remove_quotes; | |
| pagespeed EnableFilters resize_mobile_images; | |
| pagespeed EnableFilters responsive_images; | |
| pagespeed RewriteLevel OptimizeForBandwidth; | |
| location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } | |
| location ~ "^/ngx_pagespeed_static/" { } | |
| location ~ "^/ngx_pagespeed_beacon/" { } | |
| location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; } | |
| location /ngx_pagespeed_message { allow 127.0.0.1; deny all; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment