News for hackers. Stuff that matters.
Re:Speed up your sites with PageSpeed for Nginx by shawabawa3 on Friday April 26, 2013 @05:30AM (#5612115)
This didn't work for me, it did something very strange.

I have nginx set up to listen on ssl and proxy everything to my python backend in plain http (as well as serve static files)

Installing the pagespeed module (without even turning it on), caused nginx to revert to the default config (it just served the default nginx index.html and 404'd everything else) after the 3rd or 4th request.

Any ideas why this would happen?

Re:Speed up your sites with PageSpeed for Nginx by cbr on Friday April 26, 2013 @10:05AM (#5612951)
I've narrowed down the problem to a specific change, and updated the installation instructions to use a release from last week before that change. People are reporting that this fixes it for them. I'm going to be putting out an updated version, probably 1.5.27.2, that also will have this issue fixed.
Re:Speed up your sites with PageSpeed for Nginx by ludwigvan on Friday April 26, 2013 @06:43AM (#5612262)
I had the same issue, even with the same config file, with no pagespeed directive, the version with the pagespeed module failed for static files for me.

[0426/064031:INFO:google_message_handler.cc(33)] Shutting down ngx_pagespeed root

Re:Speed up your sites with PageSpeed for Nginx by cbr on Friday April 26, 2013 @08:27AM (#5612529)
I'm debugging this now. If you have anything atypical about your setup it would be great if you could post it to the bug: https://github.com/pagespeed/ngx_pagespeed/issues/292
Re:Speed up your sites with PageSpeed for Nginx by nodesocket on Thursday April 25, 2013 @04:49PM (#5609764)
I wish I didn't have to compile from source to install modules, I'd love to continue to use the official nginx YUM repo.
Re:Speed up your sites with PageSpeed for Nginx by cbr on Thursday April 25, 2013 @04:55PM (#5609802)
You can do this with Tengine [1], a version of Nginx that supports loadable modules: https://github.com/pagespeed/ngx_pagespeed/wiki/Using-ngx_pa...

[1] http://tengine.taobao.org/

Re:Speed up your sites with PageSpeed for Nginx by yareally on Thursday April 25, 2013 @05:27PM (#5609993)
If you're using Debian, dotdeb[1] comes with the ngnix-extras (includes the push stream module[2]) installed as well as some other goodies like passenger.

[1] http://www.dotdeb.org/2011/12/19/nginx-1-0-11-passenger-3-0-...

[2] https://github.com/wandenberg/nginx-push-stream-module

Re:Speed up your sites with PageSpeed for Nginx by perlgeek on Friday April 26, 2013 @10:06AM (#5612952)
Am I the only one who is worried that modules like this introduce subtle and hard-to-find bugs in the served pages? It's a layer you don't usually look at when debugging web applications.
Re:Speed up your sites with PageSpeed for Nginx by skrebbel on Friday April 26, 2013 @10:18AM (#5613030)
Good one. Anyone here got experience with the original Apache mod_pagespeed in production?
Re:Speed up your sites with PageSpeed for Nginx by Scottopherson on Friday April 26, 2013 @10:19AM (#5613037)
I've been thinking the same thing. Although, reading about how it works does help alleviate my concerns somewhat: https://github.com/pagespeed/ngx_pagespeed/wiki/Design. At the least, it seems like something worth playing around with.
Re:Speed up your sites with PageSpeed for Nginx by cbr on Thursday April 25, 2013 @04:26PM (#5609645)
Comments from when someone posted a link to a pre-alpha version: https://news.ycombinator.com/item?id=4638712
Re:Speed up your sites with PageSpeed for Nginx by druiid on Thursday April 25, 2013 @05:01PM (#5609823)
Does anyone know if this works when using Nginx as a proxy? That would be pretty killer if so.
Re:Speed up your sites with PageSpeed for Nginx by igrigorik on Thursday April 25, 2013 @05:05PM (#5609854)
Yup, in fact, that's exactly how ZippyKid integration is setup: https://www.zippykid.com/2013/04/23/partnership-with-google-...

It doesn't matter if the files are local or remote, ngx_pagespeed can fetch from both. Some docs on related functionality: https://developers.google.com/speed/docs/mod_pagespeed/domai...

Re:Speed up your sites with PageSpeed for Nginx by druiid on Thursday April 25, 2013 @05:07PM (#5609874)
Thanks for the link. I for one will be implementing this then! Probably start testing tonight actually (I'm excited).
Re:Speed up your sites with PageSpeed for Nginx by zippykid on Thursday April 25, 2013 @07:13PM (#5610570)
Druiid, do you mind testing our instructions here? http://github.com/zippykid/nginx/ ?
Re:Speed up your sites with PageSpeed for Nginx by druiid on Friday April 26, 2013 @10:44AM (#5613178)
Sure, I'll take a look at it. Might be able to send you guys some rpm instructions as well. We are a RH/CentOS shop.

Edit: Looking over your build files. I think I'm going to go ahead and create (or modify existing) spec files and throw together a github for an nginx RH tree. If anyone is interested in it when done, shoot me an e-mail through profile.

Re:Speed up your sites with PageSpeed for Nginx by druiid on Friday April 26, 2013 @01:16PM (#5614086)
Can't edit again for some reason.. so here goes for anyone that is interested. Included modified spec file and built-RPMS:

https://github.com/justicel/nginx-pagespeed

Pretty sure github is going to yell at me about the binary files :P

Re:Speed up your sites with PageSpeed for Nginx by thejosh on Friday April 26, 2013 @01:55AM (#5611697)
I kept tripping up on the instructions, such as the git clone for your repo should be the anon one (git://) and final commands (debuild -us -uc) kept telling me that there were no upstream git.

I tried the scripts verbatim on a fresh Ubuntu 13.04 VM (64bit).

edit: Your deb link at the end of the readme is broken as well.

Re:Speed up your sites with PageSpeed for Nginx by zippykid on Saturday April 27, 2013 @01:38AM (#5616934)
Thanks Josh, I'll update them tomorrow/saturday. Did you create an issue by any chance?
Re:Speed up your sites with PageSpeed for Nginx by thejosh on Thursday May 02, 2013 @11:44PM (#5648698)
You've disabled issues so I cannot add one.
Re:Speed up your sites with PageSpeed for Nginx by ludwigvan on Friday April 26, 2013 @05:45AM (#5612150)
I am currently using nginx as a proxy to Apache+mod_wsgi. nginx serves the static files too. Do you know whether I should install this module for nginx or for Apache or both?
Re:Speed up your sites with PageSpeed for Nginx by cbr on Thursday April 25, 2013 @05:04PM (#5609843)
It does; that's definitely one of the intended uses.
Re:Speed up your sites with PageSpeed for Nginx by ushi on Thursday April 25, 2013 @06:56PM (#5610490)
Oooops, http://ngxpagespeed.com/ (their demonstration site) doesn't respond at the moment...
Re:Speed up your sites with PageSpeed for Nginx by instakill on Friday April 26, 2013 @03:34AM (#5611869)
Still no response 8 hours down the line.
Re:Speed up your sites with PageSpeed for Nginx by ushi on Friday April 26, 2013 @10:09AM (#5612977)
It is back now. You can apply single filters and check out the results. It's nice to play with.
Re:Speed up your sites with PageSpeed for Nginx by jamengual on Friday April 26, 2013 @02:42AM (#5611775)
Instructions on how to install/build deb package for Ubuntu/Debian here http://serverfault.com/questions/502764/how-to-build-nginx-1...
Re:Speed up your sites with PageSpeed for Nginx by JeremyMorgan on Thursday April 25, 2013 @04:38PM (#5609703)
This is pretty sweet. What optimizations does it do other than offloading stuff to CDN?
Re:Speed up your sites with PageSpeed for Nginx by cbr on Thursday April 25, 2013 @04:42PM (#5609722)
All these: https://developers.google.com/speed/docs/mod_pagespeed/filte... So image optimization, css and js minification, cache extension, css combining, image spriting, ...

But offloading things to CDN is actually one of the things it doesn't do. You might be thinking of the PageSpeed Service [1] which is a Google-hosted version.

[1] https://developers.google.com/speed/pagespeed/service

Re:Speed up your sites with PageSpeed for Nginx by icelancer on Thursday April 25, 2013 @10:23PM (#5611165)
Wow. Thanks for bringing the service to my attention! Cut the load times on my sites by a ton.
Re:Speed up your sites with PageSpeed for Nginx by igrigorik on Thursday April 25, 2013 @04:42PM (#5609725)
You can see the complete list of filters (40+) here: https://developers.google.com/speed/docs/mod_pagespeed/confi...

Note that docs above are for mod_pagespeed (Apache), but all of the same filters are available in nginx port as well - it's the same C++ code under the hood. In a nutshell: HTML, CSS, JS, and image optimization (resizing, recompression, WebP, auto-spriting, etc...)

Configuring ngx_pagespeed: https://github.com/pagespeed/ngx_pagespeed#how-to-use

Re:Speed up your sites with PageSpeed for Nginx by JeremyMorgan on Friday April 26, 2013 @10:03AM (#5612936)
Thank you that's more helpful. Looks like a great tool
Re:Speed up your sites with PageSpeed for Nginx by zippykid on Thursday April 25, 2013 @04:39PM (#5609710)
Jeremy, image optimization/compression, javascript minification/combination etc are some of the benefits we've tested and had tremendous success with.
Re:Speed up your sites with PageSpeed for Nginx by jedberg on Thursday April 25, 2013 @09:20PM (#5610970)
If I have a static directory of files is there any way to leverage this same code to just perform the optimizations on my html so I don't have to have the webserver do it (or so I don't have to run my own webserver)?
Re:Speed up your sites with PageSpeed for Nginx by buymorechuck on Thursday April 25, 2013 @10:50PM (#5611228)
Probably not without some work. I think you have to get the PageSpeed Optimization Library and build it from source, as described here: https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSO...

(hi!)

Re:Speed up your sites with PageSpeed for Nginx by jedberg on Thursday April 25, 2013 @11:37PM (#5611347)
Hmmm. I don't really know C++ well enough to do this myself. Oh well.

Seems like it would be super useful to have a command line version of this so I could take an html file, pipe it in and get out an optimized file, and then diff them so I can learn to make my pages better.

I suppose as a hack I could set up nginx with the plugin and then load each page through curl or something and diff them that way...

Re:Speed up your sites with PageSpeed for Nginx by skrebbel on Friday April 26, 2013 @10:21AM (#5613047)
That wouldn't be a 100% match since it assumes HTTP headers and mangles them, too. For example, it probably uses the MIME type served by the proxied server to see whether it's css or js or whatever should be minified (I didn't check the sources for this).

With a pipe, it'd need to use heuristics to figure out what kind of file it is. That could be added, probably, but it's not entirely trivial.

Additionally, you'd miss out on all the HTTP header mangling, such as cache expiry settings.

Re:Speed up your sites with PageSpeed for Nginx by joevandyk on Thursday April 25, 2013 @06:00PM (#5610190)
I'm hoping heroku can support this. Maybe via a buildpack.

I'd love to get rid of using Sprockets and compiling assets.

ngx_pagespeed should take care of everything Sprockets does, right?

Re:Speed up your sites with PageSpeed for Nginx by igrigorik on Thursday April 25, 2013 @06:27PM (#5610342)
Yep, it'll concatenate files, minify them, etc., all the things you would expect. Perhaps the only caveat is: it doesn't do any dependency management, etc., which sprockets provides (if you actually use that part of it).
Re:Speed up your sites with PageSpeed for Nginx by dantiberian on Thursday April 25, 2013 @08:03PM (#5610742)
Wouldn't it be preferable to perform all of these optimizations once before page load to reduce the work that nginx has to do?
Re:Speed up your sites with PageSpeed for Nginx by dangrossman on Thursday April 25, 2013 @08:07PM (#5610755)
The work only has to be done once either way; all the file-based optimizations get cached, they're not run again on every page view.
Re:Speed up your sites with PageSpeed for Nginx by zufallsheld on Friday April 26, 2013 @01:18PM (#5614097)
I tried it on my own little webpage [1]. Results in short: 0.5 seconds to 0.9 seconds shorter load times. Beware, that I only have static content on that website.

[1] http://zufallsheld.de/2013/04/26/googles-nginx-plugin-ngx_pa...

Re:Speed up your sites with PageSpeed for Nginx by growse on Friday April 26, 2013 @08:17AM (#5612504)
This is brilliant, in principle. Getting some odd segfaults to do with libpthread-2.15.so on Ubuntu 12.10 though, so not sure what's going on there. I'll dig some more then file a bug...