Apache automatic optimization application module mod_pagespeed front page (b)

1. Load pagespeed.conf file # vim httpd.conf Include conf / extra / pagespeed.conf 2.mod_pagespeed Example illustrates # mod_pagespeed loading module LoadModule pagespeed_module /usr/local/apache2.2.15/modules/mod_pagespeed.so # determination module loading mod_deflate If the load is not loaded. mod_pagespeed automatically enabled mod_deflate compression module. # Mod_deflate deflate module provides an output filter, allows the server to be compressed before sending the output content to the client, in order to save bandwidth. <IfModule! Mod_deflate.c> LoadModule deflate_module /usr/local/apache2.2.15/modules/mod_deflate.so </ IfModule> # mod_pagespeed instruction module configuration parameters must be included in the IfModule. <IfModule pagespeed_module> # open (on) or closed (off) mod_pagespeed. ModPagespeed on # Aoache directly transmitted to all the HTML output mod_pagespeed handler. An output filter for analysis, optimization and re-serialize the HTML content. AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text / html # ModPagespeedFileCachePath and ModPagespeedGeneratedFilePrefix directory to run Apache user must be written. ModPagespeedFileCachePath "/usr/local/apache2.2.15/mod_pagespeed/cache/" ModPagespeedGeneratedFilePrefix "/usr/local/apache2.2.15/mod_pagespeed/files/" # mod_pagespeed rewrite standards. Effective standard value ModPagespeedRewriteLevel four: PassThrough, CoreFilters, TestingCoreFilters, AllFilters. The default is to rewrite the standard CoreFilters, using a series of filters to rewrite for most web pages are relatively safe. For most sites, you can not change the standard rewrite, use ModPagespeedDisableFilters and ModPagespeedEnableFilters rules appropriate fine-tuning. # ModPagespeedRewriteLevel CoreFilters # explicitly disabled specified filter, followed by a comma-separated instruction filter name, may be repeated. # ModPagespeedDisableFilters rewrite_javascript # explicitly enable the specified filter. # Add header information. ModPagespeedEnableFilters add_head # plurality of header information are combined into one, the content of the order may also be changed. ModPagespeedEnableFilters combine_heads # test filter. Completely delete a page footsteps, which would undermine the function is disabled by default. # ModPagespeedEnableFilters strip_scripts # embedded chunks of Javascript and css files can be moved to the outside, so that they can be cached in the browser, even if HTML is not cached. ModPagespeedEnableFilters outline_css, outline_javascript # css element will move to the head information. ModPagespeedEnableFilters move_css_to_head # css multiple elements merged into one. ModPagespeedEnableFilters combine_css # rewrite Javscript and CSS files, remove extra spaces and comments. ModPagespeedEnableFilters rewrite_css, rewrite_javascript # the CSS and JS files small, embedded into HTML documents. ModPagespeedEnableFilters inline_css, inline_javascript # optimize the picture re-encoded into a smaller byte size, the extra pixels deleted and not displayed inline small picture. ModPagespeedEnableFilters rewrite_images # increasing the width / height attribute to mark them do not exist. ModPagespeedEnableFilters insert_img_dimensions # is off by default. Delete comments in an HTML file. So as not to delay the destruction Javascript execution. ModPagespeedEnableFilters remove_comments # is off by default. Delete extra spaces HTML file. If the application is not detected and javascript and css labeled DOM can safely open the filter. # ModPagespeedEnableFilters collapse_whitespace # delete HTML attribute does not meet specifications. ModPagespeedEnableFilters elide_attributes # Find out all the image cache not exceeding one month, css and javascript, and extend the cache to their life cycle. This behavior is safe, because of the increased content hash URL, so if you change the URL content will also change, and can obtain the correct cache. ModPagespeedEnableFilters extend_cache # delete HTML attribute does not require quotation marks. ModPagespeedEnableFilters remove_quotes # add at the beginning and end of the page JavaScript allowable delay information is sent back to the server. ModPagespeedEnableFilters add_instrumentation # In addition to optimizing HTML resources outside, mod_pagespeed can optimize resources such as domain specified javascript, CSS, images. ModPagespeedDomain http://my_site.com ModPagespeedDomain http: //cdn.my_site. com # domain name allows the use of wildcards * and? . # By default, all HTML resources under the domain name to be rewritten. ModPagespeedAllow * # ModPagespeedDisallow * # ModPagespeedAllow http: //*my_host.com/*/images/*.png # ModPagespeedAllow http: //*my_host.com/*/styles/*.css # Set obtain the URL timeout. The default is 5 seconds. Note: in microseconds. ModPagespeedFetcherTimeoutMs 1000 # set the cache parameters. # ModPagespeedFileCacheSizeKb 102400 # ModPagespeedFileCacheCleanIntervalMs 3600000 # ModPagespeedLRUCacheKbPerProcess 1024 # ModPagespeedLRUCacheByteLimit 16384 # set the filter parameters. # ModPagespeedCssInlineMaxBytes 2048 # ModPagespeedImgInlineMaxBytes 2048 # ModPagespeedJsInlineMaxBytes 2048 # ModPagespeedCssOutlineMinBytes 3000 # ModPagespeedJsOutlineMinBytes 3000 # bindings set any time the number of pictures to be rewritten. 0 represents no binding. # ModPagespeedImgMaxRewritesAtOnce 8 # proxy settings, mod_pagespeed record requested directory site. #ModPagespeedSlurpDirectory ... # ModPagespeedSlurpReadOnly on # turn on javascript detection and statistical information on the server side. # Inject two small pieces in every HTML page javascript, used to calculate the client renders the page load time and reported to the server. ModPagespeedEnableFilters add_instrumentation <Location / mod_pagespeed_beacon> SetHandler mod_pagespeed_beacon </ Location> # use ModPagespeedBeaconUrl instructions to change to a different directory or the server. # <Location / my / path / to / beacon> # SetHandler mod_pagespeed_beacon # </ Location> # ModPagespeedBeaconUrl "/ my / path / to / beacon ets =?" # ModPagespeedBeaconUrl "http:? // my_other_server / my_beacon ets =" # disable statistics. (Mod_pagespeed0.9.11.5 or later is supported) # ModPagespeedStatistics off # view statistics. <Location / mod_pagespeed_statistics> Order allow, deny Allow from XXX.XXX.XXX.XXX SetHandler mod_pagespeed_statistics </ Location> </ IfModule> <Directory / www / mod_pagespeed_example> <IfModule headers_module> <FilesMatch "\. 5. Turn mod_pagespeed 6. statistics

Reproduced in: https: //my.oschina.net/766/blog/210860

Guess you like

Origin blog.csdn.net/weixin_33739627/article/details/91547317