mirror of
https://github.com/joglomedia/LEMPer.git
synced 2026-04-11 15:38:43 +00:00
enhance mod PageSpeed optimization
This commit is contained in:
@@ -1,34 +1,33 @@
|
||||
# Mod PageSpeed global vhost config
|
||||
pagespeed on;
|
||||
|
||||
# Memcached
|
||||
pagespeed MemcachedServers "127.0.0.1:11212";
|
||||
# time out in micro seconds
|
||||
pagespeed MemcachedTimeoutUs 1000000;
|
||||
|
||||
# Redis
|
||||
#pagespeed RedisServer "127.0.0.1:6380";
|
||||
|
||||
pagespeed EnableCachePurge on;
|
||||
pagespeed PurgeMethod PURGE;
|
||||
|
||||
|
||||
### Filters ###
|
||||
|
||||
# RewriteLevel CoreFilters | OptimizeForBandwidth | PassThrough
|
||||
pagespeed RewriteLevel CoreFilters;
|
||||
### Inherites Filters ###
|
||||
|
||||
# Enable core filters.
|
||||
pagespeed EnableFilters core,extend_cache;
|
||||
|
||||
pagespeed EnableFilters insert_dns_prefetch;
|
||||
#pagespeed EnableFilters hint_preload_subresources;
|
||||
pagespeed EnableFilters hint_preload_subresources;
|
||||
|
||||
# In-Place Resource Optimization.
|
||||
pagespeed EnableFilters in_place_optimize_for_browser;
|
||||
pagespeed InPlaceResourceOptimization on;
|
||||
#pagespeed PreserveUrlRelativity on;
|
||||
|
||||
# Rewrite Domains for CDN related.
|
||||
pagespeed EnableFilters rewrite_domains;
|
||||
|
||||
## Style Sheet (CSS).
|
||||
|
||||
# Preserve CSS url.
|
||||
#pagespeed CssPreserveURLs on;
|
||||
|
||||
# Combine CSS.
|
||||
pagespeed EnableFilters combine_css;
|
||||
pagespeed MaxCombinedCssBytes 512000;
|
||||
#pagespeed MaxSegmentLength 250;
|
||||
#pagespeed CombineAcrossPaths off;
|
||||
|
||||
# Flatten CSS imports.
|
||||
#pagespeed EnableFilters flatten_css_imports;
|
||||
@@ -44,6 +43,9 @@ pagespeed EnableFilters combine_css;
|
||||
# Prioritize critical CSS.
|
||||
pagespeed EnableFilters prioritize_critical_css;
|
||||
|
||||
# Sprites image.
|
||||
pagespeed EnableFilters sprite_images;
|
||||
|
||||
# Minify CSS.
|
||||
pagespeed EnableFilters rewrite_css;
|
||||
pagespeed EnableFilters move_css_to_head,move_css_above_scripts;
|
||||
@@ -52,9 +54,10 @@ pagespeed EnableFilters move_css_to_head,move_css_above_scripts;
|
||||
## JavaScript (JS)
|
||||
|
||||
# Combine JS.
|
||||
#pagespeed EnableFilters combine_javascript;
|
||||
#pagespeed MaxCombinedJsBytes 512000;
|
||||
#pagespeed CombineAcrossPaths on;
|
||||
pagespeed EnableFilters combine_javascript;
|
||||
pagespeed MaxCombinedJsBytes 512000;
|
||||
#pagespeed MaxSegmentLength 250;
|
||||
#pagespeed CombineAcrossPaths off;
|
||||
|
||||
# Inline JS.
|
||||
pagespeed EnableFilters inline_javascript;
|
||||
@@ -85,17 +88,21 @@ pagespeed EnableFilters lazyload_images;
|
||||
pagespeed LazyloadImagesAfterOnload off;
|
||||
pagespeed LazyloadImagesBlankUrl "https://www.gstatic.com/psa/static/1.gif";
|
||||
|
||||
# Rewrite image.
|
||||
|
||||
# By default PageSpeed able to determine if browser support for WebP,
|
||||
# so it is save to enable WebP convertion by default.
|
||||
#pagespeed EnableFilters convert_jpeg_to_progressive,convert_jpeg_to_webp,convert_to_webp_animated,convert_to_webp_lossless;
|
||||
pagespeed EnableFilters recompress_images;
|
||||
|
||||
# Shrinks the dimensions of an image to the width= or height= attribute specified in the <img> tag or
|
||||
# in the inline style= attribute.
|
||||
pagespeed EnableFilters resize_images;
|
||||
|
||||
# This is a filter group that includes inline_images, recompress_images, convert_to_webp_lossless, and resize_images.
|
||||
pagespeed EnableFilters rewrite_images;
|
||||
pagespeed EnableFilters convert_jpeg_to_progressive;
|
||||
|
||||
# Not all browsers support WebP and if using Varnish, you can improve hit rate considerably
|
||||
# by not converting images to webp. Contact Sonassi support if using Varnish with PageSpeed to
|
||||
# improve hit rate
|
||||
pagespeed DisableFilters convert_jpeg_to_webp,convert_to_webp_lossless,convert_to_webp_animated,recompress_webp;
|
||||
|
||||
# Sprites image.
|
||||
pagespeed EnableFilters rewrite_css,sprite_images;
|
||||
# This option controls the response headers PageSpeed may use when deciding how to recompress images in In-Place Resource Optimization mode.
|
||||
pagespeed AllowVaryOn Auto;
|
||||
|
||||
|
||||
### Default PageSpeed location blocks ###
|
||||
@@ -108,18 +115,6 @@ location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
|
||||
location ~ "^/pagespeed_static/" {}
|
||||
location ~ "^/ngx_pagespeed_beacon$" {}
|
||||
|
||||
### PageSpeed Statistics ###
|
||||
|
||||
# Enable.
|
||||
pagespeed Statistics on;
|
||||
pagespeed StatisticsLogging on;
|
||||
|
||||
# Administration page.
|
||||
pagespeed StatisticsPath /ngx_pagespeed_statistics;
|
||||
pagespeed MessagesPath /ngx_pagespeed_message;
|
||||
pagespeed ConsolePath /pagespeed_console;
|
||||
pagespeed AdminPath /pagespeed_admin;
|
||||
|
||||
# Statistics location blocks.
|
||||
location /ngx_pagespeed_statistics {
|
||||
allow all;
|
||||
|
||||
@@ -3,19 +3,17 @@
|
||||
# Unplugged (inactive) by default, standby, off, on.
|
||||
pagespeed unplugged;
|
||||
|
||||
# Other settings.
|
||||
pagespeed HonorCsp on;
|
||||
pagespeed RespectVary on;
|
||||
pagespeed DisableRewriteOnNoTransform off;
|
||||
#pagespeed ModifyCachingHeaders off;
|
||||
# Memcached
|
||||
pagespeed MemcachedServers "127.0.0.1:11212";
|
||||
# time out in micro seconds
|
||||
pagespeed MemcachedTimeoutUs 1000000;
|
||||
|
||||
# Do not show PageSpeed version in the header.
|
||||
pagespeed XHeaderValue "LEMPer/PageSpeed";
|
||||
# Redis
|
||||
#pagespeed RedisServer "127.0.0.1:6380";
|
||||
|
||||
pagespeed PreserveUrlRelativity on;
|
||||
#pagespeed AllowVaryOn Auto;
|
||||
|
||||
# Cache settings.
|
||||
## Cache settings ##
|
||||
|
||||
pagespeed FileCachePath "/var/cache/nginx/pagespeed_cache";
|
||||
pagespeed FileCacheSizeKb 102400;
|
||||
pagespeed FileCacheCleanIntervalMs 3600000;
|
||||
@@ -28,7 +26,39 @@ pagespeed CreateSharedMemoryMetadataCache /var/cache/nginx/pagespeed_cache 51200
|
||||
pagespeed DefaultSharedMemoryCacheKB 500000;
|
||||
pagespeed MessageBufferSize 1000000;
|
||||
|
||||
pagespeed LogDir /var/log/pagespeed;
|
||||
pagespeed EnableCachePurge on;
|
||||
pagespeed PurgeMethod PURGE;
|
||||
|
||||
|
||||
## Statistics and Admin ##
|
||||
|
||||
# Pagespeed statistic and admin panel settings.
|
||||
pagespeed Statistics on;
|
||||
pagespeed StatisticsLogging on;
|
||||
pagespeed LogDir /var/log/pagespeed;
|
||||
pagespeed UsePerVhostStatistics on;
|
||||
|
||||
# Statistics path settings.
|
||||
pagespeed StatisticsPath /ngx_pagespeed_statistics;
|
||||
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
|
||||
pagespeed MessagesPath /ngx_pagespeed_message;
|
||||
pagespeed ConsolePath /pagespeed_console;
|
||||
pagespeed AdminPath /pagespeed_admin;
|
||||
pagespeed GlobalAdminPath /pagespeed_global_admin;
|
||||
|
||||
|
||||
## Filters ##
|
||||
|
||||
# RewriteLevel CoreFilters | OptimizeForBandwidth | PassThrough
|
||||
pagespeed RewriteLevel CoreFilters;
|
||||
|
||||
|
||||
## Other settings ##
|
||||
|
||||
pagespeed HonorCsp on;
|
||||
pagespeed RespectVary on;
|
||||
pagespeed DisableRewriteOnNoTransform off;
|
||||
pagespeed ModifyCachingHeaders on;
|
||||
|
||||
# Do not show PageSpeed version in the header.
|
||||
pagespeed XHeaderValue "LEMPer/PageSpeed";
|
||||
|
||||
@@ -76,9 +76,6 @@ http {
|
||||
# gzip (default) or brotli (requires Nginx installed with brotli module).
|
||||
include /etc/nginx/comp_gzip;
|
||||
|
||||
# Mod Ngx_PageSpeed.
|
||||
include /etc/nginx/mod_pagespeed;
|
||||
|
||||
# Enable FastCGI and Proxy Cache.
|
||||
# Uncomment to enable FastCGI cache. If disabled, do not use the cached vhost setting.
|
||||
include /etc/nginx/fastcgi_cache;
|
||||
@@ -98,6 +95,9 @@ http {
|
||||
# Uncomment if you're using frontend CloudFlare CDN.
|
||||
include /etc/nginx/http_cloudflare_ips;
|
||||
|
||||
# Mod Ngx_PageSpeed (always uncomment this).
|
||||
include /etc/nginx/mod_pagespeed;
|
||||
|
||||
# Virtual host configurations.
|
||||
#index index.php index.html index.htm;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
Reference in New Issue
Block a user