nginx configuration speed

- Posted in Nginx by

configuration nginx speed

add inside block server {...}

pagespeed on;
pagespeed FileCachePath /var/cache/ngx_pagespeed;
pagespeed XHeaderValue "Powered By";
# compression CSS
pagespeed EnableFilters rewrite_css;
# merge CSS
pagespeed EnableFilters combine_css;
# Rewrite CSS´╝îOptimize CSS rules for loading rendered pages.
pagespeed EnableFilters prioritize_critical_css;
# Google fonts are written directly to html. The purpose is to reduce browser requests and DNS queries.
pagespeed EnableFilters inline_google_font_css;
# compression  js
pagespeed EnableFilters rewrite_javascript;
# merge  js
pagespeed EnableFilters combine_javascript;
# Reset http Vary header
pagespeed RespectVary on;
# Html character to lowercase
pagespeed LowercaseHtmlNames on;
# Filtering rules
pagespeed RewriteLevel PassThrough;
# Remove html blank
pagespeed EnableFilters collapse_whitespace;
# Remove html comments
pagespeed EnableFilters remove_comments;
# DNS preload
pagespeed EnableFilters insert_dns_prefetch;
# Optimize inline style properties
pagespeed EnableFilters rewrite_style_attributes;
# Compress Pictures
pagespeed EnableFilters rewrite_images;
# Do not load images outside the display area
pagespeed LazyloadImagesAfterOnload off;
# Image preloading
pagespeed EnableFilters inline_preview_images;
# Mobile image adaptive reset
pagespeed EnableFilters resize_mobile_images;
# Image lazy loading
pagespeed EnableFilters lazyload_images;
pagespeed EnableFilters sprite_images;
# Extend the cache to improve the cacheability of page resources
pagespeed EnableFilters extend_cache;
pagespeed EnableFilters combine_javascript;
pagespeed XHeaderValue "Powered By ngx_pagespeed";
pagespeed SupportNoScriptEnabled false;
# filters
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters remove_comments,collapse_whitespace;
#Admin directly accesses <domain name>/pagespeed_admin to open the administrator interface.
pagespeed Statistics on;
pagespeed StatisticsLogging off;
pagespeed LogDir /var/log/pagespeed;
pagespeed AdminPath /pagespeed_admin;
# Configuring the File Cache
pagespeed FileCacheSizeKb            1024000; # 1GB
pagespeed FileCacheCleanIntervalMs   3600000; # 1h
pagespeed FileCacheInodeLimit        500000;
# Configuring the in-memory LRU Cache
pagespeed LRUCacheKbPerProcess     1024;
pagespeed LRUCacheByteLimit        16384;
pagespeed HttpCacheCompressionLevel 3;
pagespeed EnableCachePurge on;