Welcome to Centmin Mod Community
Register Now

Nginx PageSpeed error log when using pagespeed

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by tonmo, May 1, 2020.

  1. tonmo

    tonmo Member

    36
    1
    8
    Jul 20, 2019
    Ratings:
    +5
    Local Time:
    1:25 AM
    1.17.1
    5.5.5 (10.3.16-MariaDB)
    Please fill in any relevant information that applies to you:

    • CentOS Version: CentOS 7.8.2003
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.17.10
    • PHP Version Installed: 7.4.5
    • MariaDB MySQL Version Installed: 10.3.22
    • When was last time updated Centmin Mod code base ? : Tuesday
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ?
    Code:
    LETSENCRYPT_DETECT='y'
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    MM_LICENSE_KEY='[obfuscated]'
    
    MARCH_TARGETNATIVE='n'
    LETSENCRYPT_DETECT='y'
    I'm seeing some odd recurring items in my server error log; some examples:

    Code:
    2020/04/30 15:14:13 [error] 28516#28545: [ngx_pagespeed 1.13.35.2-0] Rejected absolute url reference https://DOMAIN.com/css.php,qcss==public,P3Anormalize.css,P2Cpublic,P3Acore.less,P2Cpublic,P3Aapp.less,as==1,al==1,ad==1588072831,ak==3d1a2330a0c602b87072ef1e668ad697cd3f96a4+css.php,qcss==public,P3Aandy_similarthreads.less,P2Cpublic,P3Amessage.less,P2Cpublic,P3Anotices.less,P2Cpublic,P3Ashare_controls.less,P2Cpublic,P3Aextra.less,as==1,al==1,ad==1588072831,ak==d3ec4c7fdb5a12ddff71f9bb1c3ccddad8d59ffd.pagespeed.cc.u_5fQEyJCD.css
    and

    Code:
    2020/04/30 15:54:09 [error] 28515#28515: *5138 open() "/home/nginx/domains/DOMAIN.com/public/threads/video-features-on-giant-squid-etc.5349/page-2/js/header-rollup-554.js" failed (2: No such file or directory), client: 154.72.167.167, server: DOMAIN.com, request: "GET /threads/video-features-on-giant-squid-etc.5349/page-2/js/header-rollup-554.js HTTP/1.1", host: "DOMAIN.com"
    here is my pagespeed.conf:

    Code:
    pagespeed on;
    #######################################################
    # Purge nginx pagespeed cache
    # https://developers.google.com/speed/pagespeed/module/system#flush_cache
    #######################################################
    pagespeed EnableCachePurge on;
    pagespeed PurgeMethod PURGE;
    # https://www.modpagespeed.com/doc/https_support
       pagespeed SslCertDirectory /etc/pki/tls/certs;
       pagespeed SslCertFile /etc/pki/tls/cert.pem;
    pagespeed LoadFromFileMatch "^https?://DOMAIN.com/" "/home/nginx/domains/DOMAIN.com/public/";
    pagespeed LoadFromFileRuleMatch disallow .*;
    pagespeed LoadFromFileRuleMatch allow \.css$;
    pagespeed LoadFromFileRuleMatch allow \.jpe?g$;
    pagespeed LoadFromFileRuleMatch allow \.png$;
    pagespeed LoadFromFileRuleMatch allow \.gif$;
    pagespeed LoadFromFileRuleMatch allow \.js$;
    pagespeed Disallow */js/dark/postrating.js*;
    pagespeed Disallow */js/xenforo/tabalerts.js*;
    pagespeed Disallow */lost-password/lost;
    pagespeed Disallow */lost-password/*;
    pagespeed Disallow */payment_callback.php*;
    pagespeed Disallow */munin/*;
    pagespeed Disallow */admincp/*;
    pagespeed Disallow */cron.php*;
    pagespeed Disallow */admin.php*;
    pagespeed Disallow */css.php*;
    pagespeed Disallow */js/jquery/jquery-1.11.0.min.js*;
    pagespeed Disallow */js/xenforo/xenforo.js*;
    pagespeed Disallow */mark-read*;
    pagespeed Disallow */forums/-/mark-read*;
    pagespeed Disallow */reply/preview*;
    pagespeed Disallow */account/alerts-popup*;
    pagespeed Disallow */conversations/popup*;
    pagespeed Disallow */conversations/*;
    pagespeed Disallow */account/alerts/*;
    pagespeed Disallow */?card*;
    pagespeed Disallow */misc/quick-navigation-menu*;
    pagespeed Disallow */misc/update-cache-ttl*;
    pagespeed Disallow */deferred.php*;
    pagespeed Disallow */forums/*;
    pagespeed Disallow */attachments/*;
    pagespeed Disallow */rgba.php*;
    pagespeed Disallow */add-reply*;
    pagespeed Disallow */edit-inline*;
    pagespeed Disallow */save-inline*;
    pagespeed Disallow */posts/*/save-inline*;
    pagespeed Disallow */posts/*/edit*;
    pagespeed Disallow */posts/*/delete*;
    pagespeed Disallow */posts/*/ip*;
    pagespeed Disallow */posts/*/report*;
    pagespeed Disallow */proxy.php*;
    
    #######################################################
    # File cache settings
    ######################################
    # needs to exist and be writable by nginx
    # pagespeed FileCacheSizeKb          102400;
    # pagespeed FileCacheCleanIntervalMs 3600000;
    # pagespeed FileCacheInodeLimit      500000;
    #######################################################
    # By default, ngx_pagespeed adds an X-PageSpeed header with a value of the version of
    # ngx_pagespeed being used. This directive lets you specify the value to use instead:
    # pagespeed XHeaderValue "ngx_pagespeed";
    #######################################################
    # let's speed up PageSpeed by storing it in the super duper fast memcached
    # Ensure Memcached server installed http://centminmod.com/memcached.html
    # default install for centmin mod is on port 11211, so localhost:11211 is correct
    # uncomment - remove hash # in front of below 2 lines to enable
    # timeout set at 100 milliseconds
      pagespeed MemcachedThreads 1;
      pagespeed MemcachedServers "localhost:11211";
      pagespeed MemcachedTimeoutUs 100000;
    #######################################################
    ## 1.11.33.0 beta save-data
    ######################################
    # https://developers.google.com/speed/pagespeed/module/filter-image-optimize#image-quality
    # https://developers.google.com/speed/pagespeed/module/reference-image-optimize#JpegQualityForSaveData
    pagespeed JpegQualityForSaveData 50;
    # https://developers.google.com/speed/pagespeed/module/reference-image-optimize#WebpQualityForSaveData
    pagespeed WebpQualityForSaveData 50;
    # https://developers.google.com/speed/pagespeed/module/filter-image-optimize#resize_rendered_image_dimensions
    pagespeed EnableFilters resize_rendered_image_dimensions;
    # https://developers.google.com/speed/pagespeed/module/filter-image-optimize#WebpRecompressionQuality
    pagespeed WebpRecompressionQuality 75;
    #######################################################
    ## 1.7.30.1 beta defaults
    ######################################
    pagespeed PreserveUrlRelativity on;
    pagespeed MaxCombinedCssBytes -1;
    pagespeed ImageResolutionLimitBytes 16777216;
    pagespeed EnableFilters inline_google_font_css;
    #######################################################
    ## 1.6.29.3 beta defaults
    ######################################
    pagespeed AvoidRenamingIntrospectiveJavascript on;
    pagespeed ImageInlineMaxBytes 3072;
    pagespeed CssImageInlineMaxBytes 0;
    # pagespeed MaxInlinedPreviewImagesIndex -1;
    # pagespeed MinImageSizeLowResolutionBytes 3072;
    #######################################################
    ## ngx_pagespeed filters settings below ##
    ######################################
      # show half the users an optimized site, half the regular site
      # change UA-XXXXXXXXXX-1 to your GA unique id
      # uncomment - remove hash # in front of below 5 lines to enable
    #  pagespeed RunExperiment on;
    #  pagespeed AnalyticsID UA-XXXXXXXXXX-1;
    #  pagespeed ExperimentVariable 1;
    #  pagespeed ExperimentSpec "id=1;percent=50;level=CoreFilters;enabled=collapse_whitespace,remove_comments;";
    #  pagespeed ExperimentSpec "id=2;percent=50";
      # Filter settings
      # filters outlined at http://ngxpagespeed.com/ngx_pagespeed_example/
      pagespeed RewriteLevel CoreFilters;
      pagespeed EnableFilters collapse_whitespace,remove_comments;
      # https://www.modpagespeed.com/doc/config_filters#FinderPropertiesCacheExpirationTimeMs
    #  pagespeed FinderPropertiesCacheExpirationTimeMs 7200000;
      # https://www.modpagespeed.com/doc/config_filters#forbidding
       pagespeed ForbidAllDisabledFilters true;
      # https://www.modpagespeed.com/doc/config_filters#forbidding
       pagespeed ForbidAllDisabledFilters true;
      # https://developers.google.com/speed/pagespeed/module/filter-attribute-elide
    #  pagespeed EnableFilters elide_attributes;
      # https://developers.google.com/speed/pagespeed/module/filter-dedup-inlined-images
    #  pagespeed EnableFilters dedup_inlined_images;
      # make_google_analytics_async
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-make-google-analytics-async
    #  pagespeed EnableFilters make_google_analytics_async;
      # make_show_ads_async
      # https://developers.google.com/speed/pagespeed/module/filter-make-show-ads-async
    #  pagespeed EnableFilters make_show_ads_async;
      # responsive_images, responsive_images_zoom
      # https://developers.google.com/speed/pagespeed/module/filter-image-responsive
    #  pagespeed EnableFilters responsive_images;
    #  pagespeed EnableFilters responsive_images_zoom;
      # convert_to_webp_animated
      # https://developers.google.com/speed/pagespeed/module/filter-image-optimize#convert_to_webp_animated
    #  pagespeed EnableFilters convert_to_webp_animated;
      # inline_google_font_css
      # https://developers.google.com/speed/pagespeed/module/filter-css-inline-google-fonts
      pagespeed EnableFilters inline_google_font_css;
      # require FetchHttps if using https site
    #   pagespeed FetchHttps enable;
      # https://www.modpagespeed.com/doc/https_support
        pagespeed SslCertDirectory /etc/pki/tls/certs;
        pagespeed SslCertFile /etc/pki/tls/cert.pem;
      # inline_css
      # https://developers.google.com/speed/pagespeed/module/filter-css-inline
    #   pagespeed EnableFilters inline_css;
    #   pagespeed CssInlineMaxBytes 2048;
      # prioritize_critical_css
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-prioritize-critical-css
    #   pagespeed EnableFilters prioritize_critical_css;
      # move_css_to_head
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-to-head
      pagespeed EnableFilters move_css_to_head;
      # move_css_above_scripts
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-above-scripts
     pagespeed EnableFilters move_css_above_scripts;
      # combine_css
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-combine
     pagespeed EnableFilters combine_css;
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-combine
     pagespeed EnableFilters combine_css;
       # Uncomment this if you want to prevent mod_pagespeed from combining files
       # (e.g. CSS files) across paths
       #
    #  pagespeed CombineAcrossPaths off;
      # combine_javascript
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-js-combine
      pagespeed EnableFilters combine_javascript;
      pagespeed MaxCombinedJsBytes 122900;
      # extend_cache
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-cache-extend
    #  pagespeed EnableFilters extend_cache;
      # rewrite_css
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-css-rewrite
      pagespeed EnableFilters rewrite_css;
      # rewrite_javascript
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-js-minify
    #  pagespeed EnableFilters rewrite_javascript;
      # inline_preview_images
      # https://developers.google.com/speed/pagespeed/module/filter-inline-preview-images
      pagespeed EnableFilters inline_preview_images;
      # lazyload_images
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-lazyload-images
      pagespeed EnableFilters lazyload_images;
      # rewrite_images
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-image-optimize
       pagespeed EnableFilters rewrite_images;
       pagespeed DisableFilters rewrite_images;
    #   pagespeed DisableFilters recompress_images;
    #   pagespeed DisableFilters convert_png_to_jpeg;
    #   pagespeed DisableFilters extend_cache_images;
      pagespeed EnableFilters convert_png_to_jpeg;
      pagespeed EnableFilters convert_jpeg_to_webp;
      pagespeed EnableFilters convert_to_webp_lossless;
      # sprite_images
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-image-sprite
     pagespeed EnableFilters rewrite_css,sprite_images;
      # insert_dns_prefetch
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-insert-dns-prefetch
    #  pagespeed EnableFilters insert_dns_prefetch;
      # InPlaceResourceOptimization
      # https://developers.google.com/speed/pagespeed/module/system#ipro
      # Enabled by default as of 1.9.32.1
      pagespeed InPlaceResourceOptimization off;
    
     
  2. tonmo

    tonmo Member

    36
    1
    8
    Jul 20, 2019
    Ratings:
    +5
    Local Time:
    1:25 AM
    1.17.1
    5.5.5 (10.3.16-MariaDB)
    I'm also seeing a lot of image rewrite failures in the admin interface...

    upload_2020-4-30_12-33-34.png
     
  3. eva2000

    eva2000 Administrator Staff Member

    44,804
    10,216
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,834
    Local Time:
    3:25 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Unfortunately, ngx_pagespeed is provided as is. How you use it for your specific web app's compatibility is left up to you.

    Google search for terms "Rejected absolute url reference" might help i.e. 404 error on pagespeed optimized ressources · Issue #1279 · apache/incubator-pagespeed-ngx which suggests
    which is referred to in sticky for using ngx_pagespeed with HTTPS sites PageSpeed - This forum's pagespeed.conf
    or 404 error on pagespeed optimized ressources · Issue #1279 · apache/incubator-pagespeed-ngx
     
  4. tonmo

    tonmo Member

    36
    1
    8
    Jul 20, 2019
    Ratings:
    +5
    Local Time:
    1:25 AM
    1.17.1
    5.5.5 (10.3.16-MariaDB)
    Thanks. I'll continue to work it. In the meantime, I've used LoadFromFileMatch instead of LoadFromFile, and also commented out the Disallow.*; item. So far the error log looks OK and the pagespeed_admin page seems to show it is successfully optimizing and caching my logo. Will keep an eye on it.
    Code:
    pagespeed LoadFromFileMatch "^https?://DOMAIN.com/" "/home/nginx/domains/DOMAIN.com/public/";
    #pagespeed LoadFromFile "https://DOMAIN.com" "/home/nginx/domains/DOMAIN.com/public";
    #pagespeed LoadFromFileRuleMatch disallow .*;
    pagespeed LoadFromFileRuleMatch allow \.css$;
    pagespeed LoadFromFileRuleMatch allow \.jpe?g$;
    pagespeed LoadFromFileRuleMatch allow \.png$;
    pagespeed LoadFromFileRuleMatch allow \.gif$;
    pagespeed LoadFromFileRuleMatch allow \.js$;
    
     
  5. tonmo

    tonmo Member

    36
    1
    8
    Jul 20, 2019
    Ratings:
    +5
    Local Time:
    1:25 AM
    1.17.1
    5.5.5 (10.3.16-MariaDB)
    Here are some things I've learned with ngx_pagespeed, FWIW, and any insights or feedback is welcomed:

    1) I found it very helpful to monitor /pagespeed_global_admin/message_history and my server's error log to troubleshoot real problems. There is a lot of noise within /message_history but it's good to eliminate obvious problems so that you're left with only a few items. I get a ton of [Info] items for incomplete 3rd party calls, like "No permission to rewrite 'Hosted Libraries | Google Developers," but as I understand it, this is as designed (of course I don't have permission to rewrite google's resources). For now I'm ignoring that, but if there's a way to tamp those log messages, please chime in - I haven't found it yet.

    2) In pagespeed.conf, I added the following in order to address a large number of rewrite permission and/or not found issues:
    Code:
    pagespeed PreserveUrlRelativity on;
    #pagespeed LoadFromFileRuleMatch disallow .*;
    pagespeed Domain http*://*.domain.com;
    
    A few comments about the above:
    - I found that disallow.*; is too brute force so I commented it out. Instead, I'm calling out a number of individual restrictions.
    - the last item (pagespeed Domain) is something I found through a Google search and it specifically cleared up a a few absolute URL / rewrite issues.

    3) increasing my php memory_limit seemed to result in less errors:
    PHP Fatal Error
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,804
    10,216
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,834
    Local Time:
    3:25 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Yup that is where you figure out alot of clues :) And yes 3rd party calls can ignore those messages.

    interesting PageSpeed Configuration
    updated my example pagespeed.conf with this setting too at PageSpeed - This forum's pagespeed.conf