Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top