tschiela
tschiela

Reputation: 5271

How to optimize images from subdomain with ngx_pagespeed

Iam running ngx_pagespeed 1.9.32 on nginx 1.6.2

On my website iam using pictures from a subdomain. For example:

www.domain.com using pictures from app.domain.com/files

All works fine on www.domain.com, js, images(from same domain) and css will be concated and minfied automatically by ngx_pagespeed. The only problem is, that the images from the subdomain dont we be optimized.

That is my current config for nginx www.domain.com:

    pagespeed Domain "*.domain.com";
    pagespeed MapOriginDomain "http://localhost" "https://www.domain.com";
    pagespeed LoadFromFile "https://www.domain.com" "/var/www/wordpress/";
    pagespeed LoadFromFile "https://app.domain.com/files" "/var/www/app.termin2go.com/frontend/files";

    # Ensure requests for pagespeed optimized resources go to the pagespeed handler
    # and no extraneous headers get set.
    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_global_statistics { allow 127.0.0.1; deny all; }
    pagespeed MessageBufferSize 100000;
    location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
    location /pagespeed_console { allow 127.0.0.1; deny all; }

I tried a lot like the LoadFromFile directive and the wildcard in the Domain directive. But nothin help. Also i cant find any relevant error in the error log.

Any ideas how i cant debug or fix this?

Upvotes: 1

Views: 834

Answers (1)

Jeff Kaufman
Jeff Kaufman

Reputation: 585

pagespeed LoadFromFile "https://app.domain.com/files"
  "/var/www/app.termin2go.com/frontend/files";

You're missing a trailing slash from the end of .../frontend/files

Upvotes: 2

Related Questions