ngx_pagespeed not working properly


#1

I am playing around with EE for a few days now and there are two problems regarding to ngx_pagespeed which I cannot solve on my own.

  1. If I access the page http://mydomain/ngx_pagespeed_statistics the statistic pop up for a second and then disappears. The logs are showing the following:

    IP - - [20/Feb/2016:12:06:43 +0100] mydomain “GET /ngx_pagespeed_statistics? HTTP/1.1” 200 13965 “http://mydomain/ngx_pagespeed_statistics?cache” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36”

    IP - - [20/Feb/2016:12:06:44 +0100] mydomain “GET /ngx_pagespeed_statistics/stats_json HTTP/1.1” 404 191 "http://mydomain/ngx_pagespeed_statistics?" “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36”

    2016/02/20 12:06:44 [error] 30288#0: *509 open() “/var/www/mydomain/htdocs/ngx_pagespeed_statistics/stats_json” failed (2: No such file or directory), client: 185.17.207.32, server: mydomain, request: “GET /ngx_pagespeed_statistics/stats_json HTTP/1.1”, host: “mydomain”, referrer: "http://mydomain/ngx_pagespeed_statistics?"

The folder /var/www/mydomain/htdocs/ngx_pagespeed_statistics does not exist on my server. Did I forgot to install something regarding pagespeed?

  1. I try to get the following filter to work:

    pagespeed EnableFilters combine_javascript;

Unfortunately, nothing happens. The JS files are still not concatenated. I am testing with the Standard Theme of WP. Is it because of the attached parameters (?ver=xx) ?

Update: Problem 2) seems to be solved. After I waited a time the JS files are concatenated now. Do I have to clear any caches (beside Browser Cache) if I use the following EE command?

sudo ee site edit mydomain --pagespeed

#2

Still working on the issue and don’t know if the problem is too trivial or not. But I cannot solve it on my own.

Another problem which occurred: Pagespeed only combines e.g. JavaScript files which are in the same folder in my WordPress installation, see screenshot (e.g. in wp-includes or wp-content, etc.) . But regarding to the documentation of Pagspeed I’ve found, the concatenation should not consider the paths at all. What I am doing wrong? Or does anyone have an explanation for this?


#3

I use the plugin Autoptimize to concatenate and minify JavaScript assets. It’s far better than the unpredictable results of ModPageSpeed (or ngx_pagespeed).


#4

Thanks for your answer. I know this Plugin very well, but I’am supporting Rahul’s statement about that kind of plugins: “If you can do it in NGINX, just do it in NGINX.” Additionally, Pagespeed supports much more options for optimization than Autoptimize.


#5

I agree with you. However, I remember someone from RTCamp (perhaps Rahul himself) suggested dropping ngx_pagespeed and using Autoptimize for minification of files. At least, I didn’t know this plugin until that moment.

Perhaps we’ll need to stand by some “official” reply to this ticket. :slight_smile:


#6

Does anyone have more information (or at least further readings) on this topic? Is Pagespeed modul still recommended or should we us other alternatives?


#7

I have the same issue.

I get a better result if I remove all query vars from the file sources (e.g. ?ver=1.2), but it still doesn’t combine everything :disappointed:


#8

Hello! I also had a problem to get stats_json working. The solution is to create the file and make it accessible by the PageSpeed module. In Josefs case I would do the following:

mkdir -p /var/www/mydomain/htdocs/ngx_pagespeed_statistics/

touch /var/www/mydomain/htdocs/ngx_pagespeed_statistics/stats_json

This will create all necessary directories and files for the ngx_pagespeed_statistics to work. The problem is that PageSpeed is still in Beta which means that they have still forgotten to add some things. If there is something else missing try to create the paths and files and make them accessible by PageSpeed and it will work out for the most part.

To get a basic and nice starting config I used this tutorial:

Hope this helps.


#9

Are you aware EE dropped PageSpeed support since a month or two ago?


#10

Ohh sorry, I did not realize this. But I do not use EE, I only used their to tutorial to set up a nginx cache server where I wanted to optimize the images.


#11