ngx_pagespeed Filters considered safe for XenForo Forum?

rdn

Well-known member
This my current config:
Code:
pagespeed on;

# needs to exist and be writable by nginx
pagespeed FileCachePath /var/ngx_pagespeed_cache;

# Set it to 0 if you want to disable this feature.
pagespeed MessageBufferSize 0;

# let's speed up PageSpeed by storing it in memcached
pagespeed MemcachedThreads 1;
pagespeed MemcachedServers "localhost:11211";
pagespeed MemcachedTimeoutUs 100000;

#Defaults
pagespeed DefaultSharedMemoryCacheKB 20000;
pagespeed PreserveUrlRelativity on;
pagespeed MaxCombinedCssBytes -1;
pagespeed ImageResolutionLimitBytes 16777216;
pagespeed EnableFilters inline_google_font_css;

pagespeed AvoidRenamingIntrospectiveJavascript on;
pagespeed ImageInlineMaxBytes 3072;
pagespeed CssImageInlineMaxBytes 0;
pagespeed MaxInlinedPreviewImagesIndex -1;
pagespeed MinImageSizeLowResolutionBytes 3072;

## ngx_pagespeed filters settings below ##

  # enable CoreFilters
  pagespeed RewriteLevel CoreFilters;

  # disable particular filter(s) in CoreFilters
  pagespeed DisableFilters rewrite_images;

  # enable additional filter(s) selectively
  pagespeed EnableFilters collapse_whitespace;
  pagespeed EnableFilters lazyload_images;
  pagespeed EnableFilters insert_dns_prefetch;

But having some problems.
Any advice on the custom filters?

Thanks !
 
Last edited:
What problems are you having specifically?

The only filter I've had a "problem" with was the insert_image_dimensions filter because it screws up in-line resizing since it overwrites the "auto" attribute for height or width.

This is my Pagespeed config.
Code:
pagespeed on;
pagespeed FileCachePath nginx/pagespeed_temp;
pagespeed RewriteLevel PassThrough;
pagespeed UsePerVHostStatistics on;
pagespeed Statistics on;
pagespeed StatisticsLogging on;
pagespeed LogDir nginx/logs/pagespeed;
pagespeed MessageBufferSize 100000;

pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters rewrite_images;
pagespeed EnableFilters dedup_inlined_images;
pagespeed EnableFilters elide_attributes;
pagespeed EnableFilters lazyload_images;
pagespeed EnableFilters local_storage_cache;
pagespeed EnableFilters insert_dns_prefetch;
pagespeed EnableFilters remove_comments;
pagespeed EnableFilters remove_quotes;
pagespeed EnableFilters rewrite_style_attributes;
pagespeed EnableFilters trim_urls;
pagespeed EnableFilters insert_image_dimensions;
pagespeed EnableFilters resize_rendered_image_dimensions;
pagespeed EnableFilters convert_jpeg_to_webp;
pagespeed EnableFilters convert_to_webp_lossless;
 
After I turned on Pagespeed, most of the page just visited first time will not load. Maybe there's no cache available.
And the first time visitor will triger it to generate a cache files. I really don't know why :/
 
After I turned on Pagespeed, most of the page just visited first time will not load. Maybe there's no cache available.
And the first time visitor will triger it to generate a cache files. I really don't know why :/

Try trimming your config down to bare bones. Remove all the config options that aren't in the top block of my config to eliminate the possibility of memcached issues. Also cut out all but the core filter. The default core filters are what is deemed to be "safe" by the Pagespeed devs and will not interfere with the vast majority of web pages.

Even on the first load it should still load the page albeit slower because the server is working on parsing the output and writing optimized content to cache.
 
My forum is behind https and spdy 3.1 and your's?

No SPDY on my end. I'm not going full-time SSL until 1.3 so I'm running pretty standard.

I'm not entirely sure I'll still be running Pagespeed when I upgrade to 1.3. I'm going to take the core filters that I like and try to implement them using Nginx config options and server-side scripts using my own config. I know how to deliver webp images dynamically and I can easily write some optimization scripts. The only thing I don't know how to do off the top of my head from ngx_pagespeed is lazyloading images and inserting image dimensions to avoid page reflows.
 
  • Like
Reactions: rdn
@HittingSmoke Why didn't you use Memcached for pagespeed? :)

Caching all static assets to RAM is overkill. If your forum is mostly repeat visitors then 90% of static files aren't served by the web server anyway because they're already cached in the browser. IMO memcached really isn't practical to run unless you're load balancing. Nginx is excellent and quickly serving static files. I leave in-RAM caching for PHP opcode and serve static files from disk. Complete page load times are .3 seconds on average. Any improvement from caching static assets in RAM would be purely statistical and not noticeable to the end user.
 
What problems are you having specifically?

The only filter I've had a "problem" with was the insert_image_dimensions filter because it screws up in-line resizing since it overwrites the "auto" attribute for height or width.

This is my Pagespeed config.
Code:
pagespeed on;
pagespeed FileCachePath nginx/pagespeed_temp;
pagespeed RewriteLevel PassThrough;
pagespeed UsePerVHostStatistics on;
pagespeed Statistics on;
pagespeed StatisticsLogging on;
pagespeed LogDir nginx/logs/pagespeed;
pagespeed MessageBufferSize 100000;

pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters rewrite_images;
pagespeed EnableFilters dedup_inlined_images;
pagespeed EnableFilters elide_attributes;
pagespeed EnableFilters lazyload_images;
pagespeed EnableFilters local_storage_cache;
pagespeed EnableFilters insert_dns_prefetch;
pagespeed EnableFilters remove_comments;
pagespeed EnableFilters remove_quotes;
pagespeed EnableFilters rewrite_style_attributes;
pagespeed EnableFilters trim_urls;
pagespeed EnableFilters insert_image_dimensions;
pagespeed EnableFilters resize_rendered_image_dimensions;
pagespeed EnableFilters convert_jpeg_to_webp;
pagespeed EnableFilters convert_to_webp_lossless;
Why did you declare both
pagespeed RewriteLevel PassThrough; and pagespeed RewriteLevel CoreFilters; ?
 
I tried to enable this filter: pagespeed EnableFilters defer_javascript;
My adsense revenue decrease a lot, almost 50% :confused:.
 
This filter's are causing me problems:
Code:
pagespeed DisableFilters combine_css;
pagespeed DisableFilters defer_javascript;
pagespeed DisableFilters prioritize_critical_css;
So I disable it.
 
Hi, how can add the correct PageSpeed Authorizing and Mapping Domains for my forum that is installed in a folder call /foro/ like https://myblog.com/foro/

Right now i have in my ngnix.conf for my blog under wordpress and works very good without any problems but actually some filters of pagespeed dont work in my forum

pagespeed MapOriginDomain "http://localhost" "https://myblog.com";
pagespeed LoadFromFile "https://myblog.com" "/var/www/clients/client0/web1/web";

Which is the correct MapOriginDomain or LoadFronFile path for use

1.- pagespeed for my xenforo forum located in https://myblog.com/foro/ ?

2.- the route for disable some pagespeed filters like

pagespeed Disallow */admin.php*; in this example (*/admin.php*) works for https://myblog.com/foro/ ?

Thanks for you support.
 
Back
Top Bottom