Welcome to Centmin Mod Community
Register Now

PageSpeed This forum's pagespeed.conf

Discussion in 'Web Development & Web Performance' started by eva2000, May 26, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yeah something changed in how ngx_pagespeed works, pscontrol on enables it server wide without uncommenting main virtual.conf and domain.com.conf vhost files now. Personally, don't like this change myself. It means to disable per vhost you need to edit vhost domain.com.conf and above the 3 include lines for pagespeed at

    Code:
    pagespeed off;
    i.e.
    Code:
    # ngx_pagespeed & ngx_pagespeed handler
    pagespeed off;
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    then restart nginx
     
  2. quicksalad

    quicksalad Member

    159
    9
    18
    May 31, 2015
    Ratings:
    +13
    Local Time:
    7:14 AM
    Thanks for clearing @eva2000 , I'm surprised as I didn't go through this process ngx_pagespeed install on Centmin Mod - Menu based Nginx installer for CentOS servers and haven't touch any of this conf files
    Code:
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    is there a need for me to uncomment above code to use nginx pagespeed? It's now working by running pscontrol on, but how about the other configs? e.g disallow etc..
     
  3. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    haven't looked into it but you would only need pagespeed off added if you ran pscontrol on... but would need to uncomment those 3 lines if you want /usr/local/nginx/conf/pagespeed.conf made changes to register for your vhost IF you have pscontrol on and without pagepseed off;

    the reason is /usr/local/nginx/conf/pagespeed.conf has pagespeed on/off line too included and use to control per vhost on off until the change now

    so might need to change it to

    Code:
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    pagespeed off;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    so when you uncomment the pagespeed on in pagespeed.conf is overidden by the pagespeed off like beneath it

    Code:
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    pagespeed off;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
     
  4. quicksalad

    quicksalad Member

    159
    9
    18
    May 31, 2015
    Ratings:
    +13
    Local Time:
    7:14 AM
    if I want to use nginx pagespeed by just "pscontrol on" without touching
    Code:
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    would that consider as default nginx pagespeed config?
     
  5. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    no if you want pscontrol on then uncomment
    Code:
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    otherwise settings in pagespeed.conf are not used and yes the defaults are used which might not be ideal
     
  6. quicksalad

    quicksalad Member

    159
    9
    18
    May 31, 2015
    Ratings:
    +13
    Local Time:
    7:14 AM
    Thanks @eva2000

    is this recommended when you're running memcached? or can I comment this?
    Code:
      pagespeed MemcachedThreads 1;
      pagespeed MemcachedServers "localhost:11211";
      pagespeed MemcachedTimeoutUs 100000;
     
  7. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    up to you.. i have it enabled - might as well as memcached server is running and installed by default :)
     
  8. quicksalad

    quicksalad Member

    159
    9
    18
    May 31, 2015
    Ratings:
    +13
    Local Time:
    7:14 AM
    enabling it breaks my forum template :(
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  10. TJA

    TJA New Member

    2
    0
    1
    Jun 14, 2015
    Ratings:
    +0
    Local Time:
    2:44 AM
    1.9.2
    MariaDB 10.0.19
    Just enabled ngx_pagespeed and can't seem to figure out what I've done wrong as Defer JS isn't working.

    Code:
    pagespeed on;
    
    pagespeed LoadFromFile "http://thejack.army" "/home/nginx/domains/thejack.army/public";
    pagespeed LoadFromFile "https://thejack.army" "/home/nginx/domains/thejack.army/public";
    
    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*;
    pagespeed Disallow */lost-password/lost;
    pagespeed Disallow */lost-password/*;
    pagespeed Disallow */js/xenforo/tabalerts.js*;
    pagespeed Disallow */js/audentio/*;
    
    
    #######################################################
    # 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;
    
    #######################################################
    ## https://developers.google.com/speed/pagespeed/module/admin#virtual-hosts-and-stats
    ######################################
    # pagespeed UsePerVhostStatistics on;
    
    #######################################################
    ## 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;
    
      # make_google_analytics_async
      # https://developers.google.com/speed/docs/mod_pagespeed/filter-make-google-analytics-async
    #  pagespeed EnableFilters make_google_analytics_async;
    
      # 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;
    
       # 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 140000;
    
      # 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;
     
      pagespeed EnableFilters defer_javascript;
    
    #######################################################
    upload_2015-7-13_16-48-39.png

    upload_2015-7-13_16-49-14.png

    Advice mush appreciated :)
     
  11. quicksalad

    quicksalad Member

    159
    9
    18
    May 31, 2015
    Ratings:
    +13
    Local Time:
    7:14 AM
    Using Pagespeed add this on top of the page
    Code:
    ?PageSpeed=noscript">here</a> if you are not redirected within a few seconds.</div></noscript>
    It this okay in with Google? :) Any issue with indexing?
     
  12. rdan

    rdan Well-Known Member

    4,924
    1,174
    113
    May 25, 2014
    Ratings:
    +1,773
    Local Time:
    9:44 AM
    Mainline
    10.2
    Yes that's fine.
    Google Devs created pagespeed so that will not be an issue.
     
  13. yunos

    yunos Member

    102
    3
    18
    Aug 8, 2015
    Ratings:
    +12
    Local Time:
    3:44 AM
    1.8.0
    hey evo, was wondering if you could include which pages i should disallow for invision community forum 4.x
    http://community.invisionpower.com/

    since when i use defer js, all js on the forum are not working properly

    my main sites are run invision forum with thousands of images and serve direct downloads via php. but did i go too much with these config? my cpu xeon 1245v2 dedicated server, 32gb ram

    pagespeed on;

    pagespeed FileCachePath "/dev/shm/ngx_pagespeed/";
    pagespeed RewriteLevel PassThrough;
    pagespeed EnableFilters combine_css,combine_
    javascript,convert_jpeg_to_progressive;
    pagespeed FileCacheSizeKb 1048576;
    pagespeed FileCacheCleanIntervalMs 3600000;
    pagespeed CreateSharedMemoryMetadataCache "/dev/shm/ngx_pagespeed/" 65536;

    pagespeed ImageInlineMaxBytes 1000000;
    pagespeed MaxCombinedCssBytes -1;
    pagespeed CssImageInlineMaxBytes 0;
    pagespeed CssInlineMaxBytes 2048;
    pagespeed ProgressiveJpegMinBytes 10000;
    pagespeed ImageInlineMaxBytes 2048;

    pagespeed JsInlineMaxBytes 2048;
    pagespeed JsOutlineMinBytes 3000;

    pagespeed JpegRecompressionQuality 80;
    pagespeed ImageMaxRewritesAtOnce 7;
    pagespeed AvoidRenamingIntrospectiveJavascript on;
    pagespeed MaxCombinedJsBytes 140000;

    pagespeed RewriteLevel PassThrough;
    pagespeed EnableFilters rewrite_style_attributes_with_url,convert_to_webp_lossless,convert_meta_tags;
    pagespeed EnableFilters convert_jpeg_to_progressive;
    pagespeed EnableFilters recompress_jpeg;
    pagespeed EnableFilters jpeg_subsampling;
    pagespeed EnableFilters inline_images;
    pagespeed EnableFilters combine_css;
    pagespeed EnableFilters move_css_above_scripts;
    pagespeed EnableFilters dedup_inlined_images;
    pagespeed EnableFilters combine_javascript;
    pagespeed EnableFilters rewrite_css;
    pagespeed EnableFilters rewrite_javascript;
    pagespeed EnableFilters make_google_analytics_async;
    pagespeed EnableFilters collapse_whitespace;
    pagespeed EnableFilters extend_cache;
    pagespeed EnableFilters insert_dns_prefetch;
    pagespeed EnableFilters remove_comments;
    pagespeed EnableFilters dedup_inlined_images;
    pagespeed EnableFilters inline_google_font_css;
    pagespeed EnableFilters prioritize_critical_css;
     
  14. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    @sasiko might want to wrap oagespeed settings code in CODE tags for easier viewing.

    Unfortunately, I don't use IP.board much so you'd have to troubleshoot and tweak it yourself following the how to troubleshot Nginx pagespeed Nginx PageSpeed - Nginx Pagespeed Troubleshooting steps with examples at Nginx PageSpeed - Nginx Pagespeed Troubleshooting issues and errors and Nginx PageSpeed - ngx_pagespeed advertising conflicts ? so you can resolve issues. This thread is an example of such tweaking for Xenforo Nginx PageSpeed - This forum's pagespeed.conf
     
  15. yunos

    yunos Member

    102
    3
    18
    Aug 8, 2015
    Ratings:
    +12
    Local Time:
    3:44 AM
    1.8.0
    ye my bad but i couldnt find a bcode code icon so i just pasted it here. been obsessing on google insight test page for a while but noticed most ppl here use pagespeed ImageInlineMaxBytes 3072 but when i i used it i get alot worse result.. ended up 1000000 using it again. Screenshot by Lightshot

    i still struggle with a scheduled high server load on 15.00 cest but i read from your thread and enabled the message history so will see what is causing the issue but ive added pagespeed ImageMaxRewritesAtOnce 7; today so i will see if it helps
     
  16. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    see How to use forum BBCODE code tags | Centmin Mod Community :)

    trial and error for what is best for you but inlining too much beyond 3072 isn't good as it bloats the html page

    again try and error :) if you have issues might want to start a new thread in forum at Nginx, PHP-FPM & MariaDB MySQL | Centmin Mod Community ;)
     
  17. Matt

    Matt Moderator Staff Member

    858
    387
    63
    May 25, 2014
    Rotherham, UK
    Ratings:
    +603
    Local Time:
    2:44 AM
    1.5.15
    MariaDB 10.2
    @eva2000 - are you deduping images? The forum is only loading 1 avatar for each user per thread.
     
  18. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yeah for inline images only, let the forums reload a few times, they should show up :)
     
  19. Amin Sabet

    Amin Sabet Member

    49
    7
    8
    Nov 8, 2015
    Ratings:
    +14
    Local Time:
    9:44 PM
    @eva2000 - did you make any changes to pagespeed.conf to work with KeyCDN?
     
  20. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    11:44 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x