0

I have a couple of wordpress websites running on nginx with ngx_pagespeed (same as mod_pagespeed). It optimizes css, js, html and images and serve optimized resources from ram cache.

So I am considering moving all media to another domain/server (amazon S3). Problem is with that I will loose the ngx_pagespeed optimization.

What are my options? What do you guys think about cli optimize and replace source images before moving them to s3? Maybe a tool like Trimage would do the trick.

Another problem is these websites are feed by their owners so I cannot control image optimization pre upload. All i can do is either optimize with mod_pagespeed or bulk optimize before moving to S3.

What do you guys think? Anyone has came across a similar problem before?

Best regards.

1 Answers1

2

One is solution that gets you the best of both worlds is to use a CDN that supports origin pull, like Amazon CloudFront, and configuring the ModPagespeedMapRewriteDomain option in mod_pagespeed (see the section on Mapping Rewrite Domains).

This works as such. When you configure the MapRewriteDomain option, you'll set it up so that mod_pagespeed will change the URL of optimized resources (images, js, etc.) to use the CDN's domain. When the CDN receives a request for a resource it doesn't have, it will fetch it from the origin domain, and cache it (this is the origin pull feature). That way you'll be able to get the benefits of both a CDN for your static resources, and mod_pagespeed's resource optimization features.

Jud
  • 552
  • 4
  • 9
  • Jud, thanks alot. This question is mine. Sorry I did not accepted it earlier. For some reason the question was created with a different (brand new) user, so no notifications for me. Anyway - I have been very busy hacking away with nginx for best performance. I had dropped ngx_pagespeed optimizations, mainly because of cpu costs (minification, gzip on the fly, the fact that you cannot cache gzipped assets...). Well, I tried alot of things in the meantime, but I came back to pagespeed because all of them are poor and fond my own question on Google (lol). Ends up you nailed it: Cloudfront CDN. TY – ddutra Oct 16 '13 at 20:48
  • OH! And for images, I'll just do some dimension optimization via CLI on Linux because users tend to upload huge images. And something like https://github.com/doda/imagy can keep an eye on my media folder and keep everything optimized. I can add ngx_pagespeed on top of everything. Best regards. – ddutra Oct 16 '13 at 20:51