External Javascript and CSS files not optimized

80 views
Skip to first unread message

Jeremy Nowka

unread,
Dec 13, 2014, 5:56:05 PM12/13/14
to ngx-pagesp...@googlegroups.com
I am having an issue with Pagespeed on Nginx not optimizing external resources, but optimizing resources within the page content.  
I am only optimizing content on an internal web server at this time until I can finish getting the settings right.
By unoptimized I mean comments are not stripped, space is not stripped.


OS: CentOS 6.6
Nginx Version: 1.6.2
Google Pagespeed Version 1.9.32.2-beta


My Nginx Config
nginx.conf http config:
    # Pagespeed Configurations
    pagespeed FileCachePath        "/var/cache/nginx/pagespeed/server/";
    pagespeed FileCacheSizeKb      1024000;
    pagespeed LRUCacheKbPerProcess 8192;
    pagespeed LRUCacheByteLimit    16384;


server config:
    # Site Specific Google Pagespeed Optimizations
    pagespeed                                   on;
    pagespeed FetchHttps                  enable;
    pagespeed Domain                       "www.something.com";
    pagespeed FileCachePath             "/var/cache/nginx/pagespeed/www.something.com/";
    pagespeed RespectVary               on;
    pagespeed LowercaseHtmlNames on;
    pagespeed RewriteLevel                OptimizeForBandwidth;

    # CSS
    pagespeed EnableFilters               combine_css;
    pagespeed EnableFilters               rewrite_css;

    # JS
    pagespeed EnableFilters               combine_javascript;
    pagespeed EnableFilters               rewrite_javascript;

    # HTML
    pagespeed EnableFilters               collapse_whitespace;
    pagespeed EnableFilters               elide_attributes;
    pagespeed EnableFilters               remove_comments;

Otto van der Schaaf

unread,
Dec 15, 2014, 4:15:22 AM12/15/14
to ngx-pagesp...@googlegroups.com
Are you sure that ngx_pagespeed is running correctly? Do you see other optimizations applied?
If so, could you post a fragment of html with comments or whitespace that you would have expected to be removed?

Otto

--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at http://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Jeff Kaufman

unread,
Dec 15, 2014, 7:59:02 AM12/15/14
to ngx-pagesp...@googlegroups.com
The collapse_whitespace is a simple enough filter that if it's not
applying the problem is usually "pagespeed isn't running at all" and
not something wrong with the details of your configuration. If you
have any leading whitespace in your file, it should be removing it.

If you fetch the page and look at the headers is there an X-Page-Speed?

Are you sure this is the configuration file nginx is loading? If you
put something obviously invalid in the file like "pagespeed
unknownoption;" does it give you an error and fail to start?

Jeff Kaufman

unread,
Dec 15, 2014, 8:13:55 AM12/15/14
to ngx-pagesp...@googlegroups.com
Sorry, I misread your post. You're talking about external resources,
and I was answering for the case where the html wasn't being
optimized.

Could you give an example html snippet that refers to an external
resource that should be optimized but isn't?

Jeremy Nowka

unread,
Dec 15, 2014, 1:46:38 PM12/15/14
to ngx-pagesp...@googlegroups.com
>>> Visit this group at http://groups.google.com/group/ngx-pagespeed-discuss.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ngx-pagespeed-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an

Jeremy Nowka

unread,
Dec 15, 2014, 2:05:36 PM12/15/14
to ngx-pagesp...@googlegroups.com
One more thing, the javascript files do not contain the X-Page-Speed entry.

Jeff Kaufman

unread,
Dec 15, 2014, 2:23:15 PM12/15/14
to ngx-pagesp...@googlegroups.com
Fetching https files requires some configuration:
https://developers.google.com/speed/pagespeed/module/https_support
> --
> You received this message because you are subscribed to the Google Groups
> "ngx-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ngx-pagespeed-di...@googlegroups.com.

Jeremy Nowka

unread,
Dec 16, 2014, 3:18:46 PM12/16/14
to ngx-pagesp...@googlegroups.com
Thank you for your help.  I have added the following and it optimizes my static external content now.

pagespeed LoadFromFile                "https://www.something.com/path/to/static"   "/var/www/drupal/path/to/static";

On Saturday, December 13, 2014 2:56:05 PM UTC-8, Jeremy Nowka wrote:
Reply all
Reply to author
Forward
0 new messages