pagespeed not optimizing pages properly?

196 views
Skip to first unread message

Michael Taboada

unread,
Apr 16, 2017, 12:51:00 AM4/16/17
to ngx-pagesp...@googlegroups.com
Hi,
I'm having trouble with pingdom website test (which I think uses pagespeed as part of it's backend) giving me really bad scores on some of the things pagespeed is supposed to optimize, so I was wondering if I did something wrong in my nginx config.

nginx.conf pagespeed specific directives:

load_module /usr/lib/nginx/modules/ngx_pagespeed.so;
pagespeed on;
pagespeed FileCachePath "/tmp/ngx_pagespeed_cache";
pagespeed FileCacheSizeKb 256000;
pagespeed FileCacheCleanIntervalMs 3600000;
pagespeed FileCacheInodeLimit 500000;

server specific pagespeed settings:

# 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 ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters responsive_images,combine_heads,move_css_to_head,outline_javascript,outline_css,rewrite_style_attributes,prioritize_critical_css,make_google_analytics_async,make_show_ads_async,canonicalize_javascript_libraries,local_storage_cache,convert_to_webp_animated,insert_image_dimensions,inline_preview_images,remove_comments,collapse_whitespace,elide_attributes,extend_cache_pdfs,sprite_images,trim_urls,dedup_inlined_images,lazyload_images,insert_dns_prefetch,hint_preload_subresources,in_place_optimize_for_browser;
pagespeed LowercaseHtmlNames on;

Any clue? You can see my site at https://2mb.solutions.
-Michael.
P.S. The main rules that pingdom complains about are combine external css, js, and others like that.

Longinos

unread,
Apr 16, 2017, 4:51:25 AM4/16/17
to ngx-pagespeed-discuss
Hi Michael
You have no mention to Cloudflare in your post and I think that the issue. Put Cloudflare in a transarent mode (disable it or put in dev mode) and test your site.

Michael Taboada

unread,
Apr 25, 2017, 3:49:50 AM4/25/17
to ngx-pagespeed-discuss
Hi,
Sorry about just getting back -- for some reason it didn't subscribe me via email, so I'm just seeing this now. I put cloudflare in "development mode" and tested again, the score is basically the same (with the addition of a bunch of 302 redirects for some odd reason). The main thing is still that all the css, js, etc are all separate. There's like many css files, and even more js files. In addition, the jquery, and other such libraries are not loading from googles servers, or any other hosted source. This makes me think pagespeed isn't working, but I'm not sure how to fix that, as I don't get any error about it in my log. The only error I get (which I'm pretty sure started when I enabled pagespeed, but it coudl just be coincidential), is:


2017/04/25 06:20:04 [error] 15611#15611: *49738 FastCGI sent in stderr: "PHP message: WordPress database error Got a packet bigger than 'max_allowed_packet' bytes for query UPDATE `wp2mb_5_options` SET `option_value` = 'a:6430:{s:53:\"/storage/websites/2mb.solutions/public_html/index.php\";s:32:\"b61b25303be0f573a6b9446d5cbe3a5b\";s:52:\"/storage/websites/2mb.solutions/public_html/test.php\";s:32:\"a647e6844a927b2276765771c4c80918\";s:61:\"/storage/websites/2mb.solutions/public_html/wordfence-waf.php\";s:32:\"918496adcfa12d710e1e4582555f7177\";s:59:\"/storage/websites/2mb.solutions/public_html/wp-activate.php\";s:32:\"7ba38b3c2c9f6848fbdaff94b0a182b4\";s:62:\"/storage/websites/2mb.solutions/public_html/wp-blog-header.php\";s:32:\"edad74614d6d3fa2252c3d74ff037ac7\";s:64:\"/storage/websites/2mb.solutions/public_html/wp-comments-post.php\";s:32:\"e54cae70b7252c32c1f9c0c8c1a7d1a4\";s:64:\"/storage/websites/2mb.solutions/public_html/wp-config-sample.php\";s:32:\"d1490486fc3f4965a6200256a7fe11b9\";s:57:\"/storage/websites/2mb.solutions/public_html/wp-config.php\";s:32:\"8be97e6073f5...


-Michael.

Michael Taboada

unread,
Apr 25, 2017, 4:19:45 AM4/25/17
to ngx-pagespeed-discuss
Hi,
I just did a little debugging with curl -s -H "PageSpeedFilters: +debug" https://2mb.solutions/ and didn't get any comments seeming to be from pagespeed, so I still can't see if there's any errors.
-Michael.

Longinos

unread,
Apr 26, 2017, 4:55:01 AM4/26/17
to ngx-pagespeed-discuss
"*49738 FastCGI sent in stderr: "PHP message: WordPress database error"
That is a database error, not related with pagespeed. You must set a bigger value to the max_allowed_packet parameter in the mysql config file.
I never tried to debug with curl, but the syntax was bad, must be  https://2mb.solutions/?PageSpeedFilters=+debug ,  not as a header.
When I tried https://2mb.solutions/?PageSpeedFilters=+debug in chrome I see some resources are rewited by pagespeed, some images are inlined and some js files are combined and some js code are injected by pagespeed like this:

<img data-pagespeed-high-res-src="wp-content/uploads/2015/03/xme_and_gunther2-e1477122863849.jpg.pagespeed.ic.aRlnW7Dfeb.webp"

<script src="wp-content,_plugins,_epoch,_,_assets,_js,_front,_epoch.min.js,qver==1.0.14+wp-includes,_js,_wp-embed.min.js,qver==6ce0eae0dcdc2283fb83b14dee3d5e09.pagespeed.jc.q0wuEL5Zmy.js"></script>

and get this header in the main request

x-page-speed:
1.11.33.4-0

Thus the pagespeed module is working.
I think Cloudflare is the issue, because is caching resources that are not optimized and serve these unoptimized resources.
Other possible issues can be Cloudflare config as minify, rocket and so....
My advice is disable Cloudflare, not only in dev mode (dev mode disables it in a limited time gap) debug all the pagespeed issues and when you had these issues solved, enable Cloudflare and make it work with pagespeed

Michael Taboada (AI5HF)

unread,
Apr 26, 2017, 9:21:38 AM4/26/17
to ngx-pagesp...@googlegroups.com
Hey,
The only problem I'm finding with that interpretation is that when I put it in development mode, meaning it shouldn't show cash at all, it was still pulling mini mini mini single CSS and js files. Also from what I've read on the cloud flair knowledgebase, they should respect the nocache header, which pagespeed is setting. I will try to turn off cloud flair then see where that gets me though.
Michael. 

Sent from my iPhone
--
You received this message because you are subscribed to a topic in the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ngx-pagespeed-discuss/zmABX6oGhdE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at https://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Longinos

unread,
Apr 27, 2017, 3:21:51 AM4/27/17
to ngx-pagespeed-discuss
The no cahe header from pagespeed module is only set html request, all other subresources get a cahe extended header


El domingo, 16 de abril de 2017, 6:51:00 (UTC+2), Michael Taboada escribió:
Reply all
Reply to author
Forward
0 new messages