Posted by brianmercer on May 7, 2013 at 12:04am
A couple weeks ago a Google Pagespeed module for nginx was released as beta. It has some interesting filters that process things like css files, js files, images, html and headers. See https://developers.google.com/speed/docs/mod_pagespeed/filters
I added it to a test version of my Ubuntu 12.04 nginx package on Launchpad. You can install it with
add-apt-repository ppa:brianmercer/testing
aptitude update
aptitude install nginx-pagespeedthen create a directory for it (I'll do this in the package eventually)
mkdir /var/cache/nginx/pagespeed
chown www-data /var/cache/nginx/pagespeedand add some directives to your nginx server{} section
pagespeed on;
pagespeed FileCachePath /var/cache/nginx/pagespeed;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
location /ngx_pagespeed_statistics {
allow 127.0.0.1; deny all;
}
location /ngx_pagespeed_message {
allow 127.0.0.1; deny all;
}Many of these optimization techniques we already do by hand. I don't have any impressions of it yet, except that the idea of doing some of these things at the web server level is interesting.
Let me know if you have any problems with the package.
Comments
How can I install it if I
How can I install it if I compile Nginx from the source?
There are instructions in the
There are instructions in the README. https://github.com/pagespeed/ngx_pagespeed
Hmm, I guess I'm doing something wrong...
So I did
add-apt-repository ppa:brianmercer/testing, and that certainly worked.But then, when running aptitude, I only get:
Couldn't find any package whose name or description matched "nginx-pagespeed"What step am I missing here?
I'm just a virtual girl in a virtual world...
ah yes, it needs this in
ah yes, it needs this in there:
aptitude updateWorks great! Do I need a
Works great!
Do I need a Advanced CSS/JS Aggregation module anyway or it's useless?
But now CPU load is much
But now CPU load is much higher for Nginx. It's temporary or permanent?
Those are both good
Those are both good questions. I'm still experimenting with and evaluating this module. That's good to know about the CPU load.
Now cpu load is decreased. Do
Now cpu load is decreased.
Do we really need drupal's css/js optimisation modules or Google page speed can handle all this?