Search
j0ke.net Open Build Service
>
Projects
>
home:jg
:
http-testing
>
nginx
> ngx_pagespeed.conf.sample
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File ngx_pagespeed.conf.sample of Package nginx (Revision 119)
Currently displaying revision
119
,
show latest
pagespeed on; pagespeed RewriteLevel CoreFilters; # needs to exist and be writable by nginx pagespeed FileCachePath /var/cache/nginx/ngx_pagespeed; ################################################################################ ## Statistics logging ## ################################################################################ pagespeed Statistics on; pagespeed StatisticsLogging on; pagespeed LogDir /var/log/pagespeed; ################################################################################ ## Optimize caching ## ################################################################################ # This filter identifies popular JavaScript libraries that can be replaced with # ones hosted for free by a JavaScript library hosting service — by default the # Google Hosted Libraries. #pagespeed EnableFilters canonicalize_javascript_libraries; # Improve the cacheability of a web page's resources without compromising the # ability to change the resources and have those changes propagate to users' # browsers. pagespeed EnableFilters extend_cache; # 'Extend Cache PDFs' is a version of Extend Cache that acts on PDFs. Unlike # 'Extend Cache' it applies not only to resources but also to hyperlinks. #pagespeed EnableFilters extend_cache_pdfs; # The 'Outline JavaScript' filter outlines all JavaScript that is larger than a # minimum threshold in bytes. #pagespeed EnableFilters outline_javascript; #pagespeed JsOutlineMinBytes 3000; ################################################################################ ## Minimize round-trip times ## ################################################################################ # 'Combine CSS' seeks to reduce the number of HTTP requests made by a browser # during page refresh by replacing multiple distinct CSS files with a single CSS # file, containing the contents of all of them. pagespeed EnableFilters combine_css; # 'Move CSS Above Scripts' seeks to make sure scripts do not block the loading # of CSS resources. pagespeed EnableFilters move_css_above_scripts; # Recursively processes imported CSS files; if a file cannot be processed then # the entire process is aborted and the initial CSS is left unflattened. pagespeed EnableFilters flatten_css_imports; #pagespeed CssFlattenMaxBytes bytes; # When the 'Inline CSS' filter is enabled, The contents of small external CSS # resources are written directly into the HTML document; therefore the browser # does not request those CSS resources independently. pagespeed EnableFilters inline_css; #pagespeed CssInlineMaxBytes bytes; # When the 'Inline Google Fonts API CSS' filter is enabled, the contents of the # small external CSS resources produced to load the fonts are written directly # into the HTML document; the browser does not need to request those CSS # resources independently. pagespeed EnableFilters inline_google_font_css; # 'Combine JavaScript' seeks to reduce the number of HTTP requests made by a # browser during page refresh by replacing multiple distinct JavaScript files # with a single one. pagespeed EnableFilters combine_javascript; #pagespeed MaxCombinedJsBytes MaxBytes; #pagespeed MaxSegmentLength 250; #pagespeed CombineAcrossPaths off; # This affects filters rewrite_javascript, combine_javascript, # inline_javascript, extend_cache, and extend_cache_scripts. # # Off by default, turn it on if something looks wrong. pagespeed AvoidRenamingIntrospectiveJavascript on; # The contents of small external JavaScript resources are written directly into # the HTML document; therefore, the browser does not request those JavaScript # resources. #pagespeed EnableFilters inline_javascript; # Detects GIF and PNG images used as backgrounds in CSS. It attempts to combine # all such images referenced from a CSS file into a single large image. # # Requires the 'Rewrite CSS' filter (rewrite_css) pagespeed EnableFilters sprite_images; # his filter reduces DNS lookup time by providing hints to the browser at the # beginning of the HTML, which allows the browser to pre-resolve DNS for # resources on the page. pagespeed EnableFilters insert_dns_prefetch; ################################################################################ ## Minimize request overhead ## ################################################################################ # Applies all domain mapping directives specified in pagespeed.conf to web # resources that are not otherwise rewritten by PageSpeed. For example, if a # resource is not cacheable, or filters which affect the resource are turned # off, then it still may be desirable to apply domain sharding. pagespeed EnableFilters rewrite_domains; # #pagespeed MapRewriteDomain domain_to_write_into_html # domain_specified_in_html; ################################################################################ ## Minimize payload size ## ################################################################################ # Reduces bytes transmitted in an HTML file by removing unnecessary whitespace. pagespeed EnableFilters collapse_whitespace; # Combines multiple heads into one #pagespeed EnableFilters combine_heads; # Reduces the transfer size of HTML files by removing attributes from tags when # the specified value is equal to the default value for that attribute #pagespeed EnableFilters elide_attributes; # Minifies JavaScript code, using an algorithm similar to that in Douglas # Crockford's popular JSMin program pagespeed EnableFilters rewrite_javascript; # This is equivalent to enabling inline_images, recompress_images, # convert_png_to_jpeg, and resize_images. # # In every case, the image on the page is replaced by the optimized version only # if the optimized version is actually smaller than the original. pagespeed EnableFilters rewrite_images; # This rewriter improves page render times by identifying CSS rules needed to # render the page, inlining those critical rules and deferring the load of the # full CSS resources. pagespeed EnableFilters prioritize_critical_css; # Reduce the transfer size of HTML files by eliminating redundant image data URLs. pagespeed EnableFilters dedup_inlined_images; # Eliminates HTML comments pagespeed EnableFilters remove_comments; #pagespeed RetainComment " google_ad_section*"; # The quote removal filter eliminates unnecessary quotation marks # (either "" or '') from HTML attributes. #pagespeed EnableFilters remove_quotes; # Parse linked and inline CSS, rewrites the images found and minifies the CSS. # The filter works on CSS found in <style> blocks and <link> refs. pagespeed EnableFilters rewrite_css; pagespeed EnableFilters fallback_rewrite_css_urls; # Rewrites the CSS inside elements' style attributes as performed by # rewrite_css, which includes CSS minification, image rewriting, image # recompression, and cache extension, if enabled. # # If both are enabled, rewrite_style_sttributes takes precedence. pagespeed EnableFilters rewrite_style_attributes; #pagespeed EnableFilters rewrite_style_attributes_with_url; # Trims URLs by resolving them by making them relative to the base URL for the # page. e.g. on http://www.example.com/, "http://www.example.com/foo" would be # shortened to "foo" pagespeed EnableFilters trim_urls; ################################################################################ ## Optimize browser rendering ## ################################################################################ # Adds a response header that matches each meta tag with an http-equiv attribute. # For example, <meta http-eqiv="Content-Language" content="fr"> would be # converted to Content-Language: fr in the response headers. # The original tag is left unchanged. pagespeed EnableFilters convert_meta_tags; # Tries to defer JavaScript execution until page load. It defers this by # changing the type and src attributes of <script> elements on the HTML page pagespeed EnableFilters defer_javascript; # Generates low quality versions of the images that are inlined in the HTML page. pagespeed EnableFilters inline_preview_images; pagespeed EnableFilters resize_mobile_images; #pagespeed MaxInlinedPreviewImagesIndex IndexNumber; #pagespeed MinImageSizeLowResolutionBytes MinBytes; # Optimize browser rendering and reduce number of HTTP round-trips by deferring # the loading of images which are not in the client's viewport. # # This breaks Orbit slider as at Foundation 5.2.1 #pagespeed EnableFilters lazyload_images; # Reduce the number of times the browser must re-flow the document by ensuring # that the CSS styles are all parsed in the head, #pagespeed EnableFilters move_css_to_head; ################################################################################ ## CSS Filters ## ################################################################################ ################################################################################ ## JavaScript Filters ## ################################################################################ ################################################################################ ## Image Filters ## ################################################################################ ################################################################################ ## Nginx Location Parameters ## ################################################################################ # Ensure requests for pagespeed optimized resources go to the pagespeed handler # and no extraneous headers get set. location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } location ~ "^/ngx_pagespeed_static/" { } location ~ "^/ngx_pagespeed_beacon$" { } location /pagespeed_console { allow 127.0.0.1; allow 79.168.198.221; deny all; } location /ngx_pagespeed_statistics { allow 127.0.0.1; allow 79.168.198.221; deny all; } location /ngx_pagespeed_global_statistics { allow 127.0.0.1; allow 79.168.198.221; deny all; } location /ngx_pagespeed_message { allow 127.0.0.1; allow 79.168.198.221; deny all; }