Want more timely Centmin Mod News Updates?
Become a Member

Nginx PageSpeed I almost got it. Can't enable pagespeed for SSL.

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by cr0, Aug 28, 2017.

  1. cr0

    cr0 Member

    37
    2
    8
    Aug 21, 2017
    Ratings:
    +2
    Local Time:
    11:44 AM
    • CentOS Version: CentOS 7 64bit ?
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.13.4
    • PHP Version Installed: 7.1.8
    • MariaDB MySQL Version Installed: 10.1.26
    • When was last time updated Centmin Mod code base ? : fresh install
    • Persistent Config: None
    Thank you once again! Hopefully this is the last time I'm asking for help here.

    I installed WordPress + free CloudFlare certificates, everything looks good. SPDY / HTTP2 is working too, great!

    Now I'd like to include pagespeed, I tried to add
    Code:
    pagespeed on
    to vhost configs and
    Code:
    pagespeed LoadFromFile "https://community.centminmod.com" "/home/nginx/domains/community.centminmod.com/public";
    to pagespeed configs but nothing (yep I restarted nginx). In order to not f%·k up anything by trying trial and error method, I'd like to ask for help first.

    BY THE WAY

    Eva, hopefully you're reading this. I can't donate you now, but hey your project is wonderful and you're doing an AMAZING job, thank you for that. I've been thinking about how to be grateful enough because that's who I am and hopefully this works for you better than a donation. Hopefully you take criticism and opinions about your stuff wholeheartedly, if not, sorry.

    Listen, you got a whole lot of amazing information here. EasyEngine and few other competitors will fall apart just because of how active you're in comparison. Now my suggestions are:
    • Organize your content, there's a lot of old stuff that doesn't interest the user. Follow the steps of digitalocean: Initial Server Setup with Ubuntu 16.04 | DigitalOcean. Easy simple, organized and informative
    • Your project stand out, but the website not so much (design / structure too). Instead of filling it with so much information, try to minimize it and add the most common, searched installing guides on the main page, for example, for a dummy like me:
    • Add your 09 beta on mainpage, let people choose, it works wonderful and is up to date.
    • Speak more with benefits than with features, big and bold on the mainpage - One click installation, up to date, fully optimized for maximum performance Nginx LEMP stack with WordPress support and much more, to save your precious time on (insert most popular VPS names for SEO) installation. Very active community.
    • Does it worth all the hassle? But what about money? Or so you will say. I don't know about your principles but there's always room for some money. Opensource project is amazing and people can donate you a lot. You're already asking for donations but you can add those donation buttons in a slick manner in the mainpage along the download button, or after pressing it, saying something like "This project is free for everyone and we're doing the best to keep it afloat, but it doesn't feed itself. Did we save you the hassle? Please consider a donation here: (give options, people love to choose)". Albeit it can be shorter, but biiig big distinctive button on the mainpage would be good. Also on the installation page / ssh launch window.
      • Add a lot of referral links on your guides but don't be greedy, if this project turns out about the money it will sink.
    I can help you a bit if I got sometime if you want, for free. In the copywriting and organizing sense, also some designing.

    Have a great, wonderful day and thank you once again for doing all this!
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
    learning means asking questions so don't be afraid to learn :)

    FYI, 123.08stable no longer works with ngx_pagespeed, you need to update to 123.09beta01 for ngx_pagespeed. See news thread at Nginx 1.9.11 dynamic module compatibility. 123.08stable has disabled ngx_pagespeed and lua nginx modules due to incompatibility with nginx 1.9.11 dynamic modules.

    If you want ngx_pagespeed for now you need to update Centmin Mod to 123.09beta01 outlined here Beta Branch - Centmin Mod .09 beta branch Testing

    With 123.09beta01, set in /etc/centminmod/custom_config.inc persistent config file you create or already created and set:
    Code (Text):
    NGINX_PAGESPEED=y
    NGXDYNAMIC_NGXPAGESPEED=y
    

    and then recompile Nginx 1.13.4+ or higher via centmin.sh menu option 4

    Then tweak pagespeed.conf for your site and troubleshoot. Here's some links for examples and help
    1. https://centminmod.com/nginx_ngx_pagespeed.htm
    2. Nginx PageSpeed - This forum's pagespeed.conf | Centmin Mod Community
    3. Nginx PageSpeed - Nginx Pagespeed Troubleshooting steps | Centmin Mod Community
    4. Nginx, PHP-FPM & MariaDB MySQL | Centmin Mod Community
    5. Install & Upgrades or Pre-Install Questions | Centmin Mod Community
    Yes all 123.09beta01 info is on forums only right now and it's why 123.09beta01 is still beta as waiting on me to update and write updated 123.09 documentation on official centminmod.com site before i make 123.09stable announcement

    And yup donation notices will be more prominent once 123.09beta01 goes stable. Lots of stuff is just waiting on 123.09stable documentation update by me on official centminmod.com site :)
     
    • Like Like x 1
  3. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
    you need to replace that with your own full domain path not use my exact example
     
    • Like Like x 1
  4. cr0

    cr0 Member

    37
    2
    8
    Aug 21, 2017
    Ratings:
    +2
    Local Time:
    11:44 AM
    Yep, I already did, and it's installed on 09beta.

    From what I've read pagespeed is already activated for all vhosts right? I uncommented pagespeed includes in vhosts configs too, but it's still the same.
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
    yes it's activated for all vhosts IF you uncomment the 3 pagespeed include files in the vhost config file.

    but what do you mean it's still the same ? pagespeed needs a few page reloads to learn what to optimise before it optimises assets

    You'd have to troubleshoot and tweak it yourself following these guides and info outlined below
     
    • Like Like x 1
  6. cr0

    cr0 Member

    37
    2
    8
    Aug 21, 2017
    Ratings:
    +2
    Local Time:
    11:44 AM
    Alright, thank you! I got it working for HTTP (I had to move pagespeed.conf to conf.d folder and add pagespeed on, on the top of it, just write pscontrol on in ssh), but I'm not sure if it's working for https. When I'm running the Is mod_pagespeed working? test (on https), the headers aren't found, but when I run
    Code:
    curl -I -X GET localhost
    
    it's working like a charm. (on http)

    I tried this on pagespeed.conf:

    Code:
    
    pagespeed MapOriginDomain "http://localhost" "https://domain.com";
    pagespeed LoadFromFile "https://domain.com" "/home/nginx/domains/domain.com/public";
    
    pagespeed SslCertDirectory /usr/local/nginx/conf/ssl/domain.com;
    pagespeed SslCertFile /usr/local/nginx/conf/ssl/domain.com/public.pem;
    
    pagespeed FetchHttps enable,allow_self_signed;
    
    also
    
    pagespeed FetchHttps enable;
    
    
    Thanks! By the way, glad to hear about your future vision :)
     
    Last edited: Aug 29, 2017
  7. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
    1st post https://community.centminmod.com/threads/this-forums-pagespeed-conf.62/ see mid way down for https config. Don't need SslCert*

    example for my centminmod.com site
    Code (Text):
    pagespeed FetchHttps enable;
    #pagespeed LoadFromFile "http://centminmod.com" "/home/nginx/domains/centminmod.com/public";
    #pagespeed LoadFromFile "https://centminmod.com" "/home/nginx/domains/centminmod.com/public";
    
    pagespeed LoadFromFileMatch "^https?://centminmod.com/" "/home/nginx/domains/centminmod.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$;
    

    don't need LoadFromFile so commented it out if you have a LoadFromFileMatch version for both http and https
     
  8. cr0

    cr0 Member

    37
    2
    8
    Aug 21, 2017
    Ratings:
    +2
    Local Time:
    11:44 AM
    Just did it but I receive the same result: [​IMG]
    Maybe it's supposed to be like that? On http I can see the header:
    Code:
    X-Page-Speed: 1.12.34.2-0
    Last thing

    I'm receiving the following when trying to use pagespeed console:

    Code:
    Failed to load PageSpeed Console because:
    
    - StatisticsLogging is not enabled.
    - LogDir is not set.
    I did
    Code:
    pscontrol statson
    and allowed my public ip -from this post- (hence I can connect to the page), also checked that it's enabled in pagespeedstatslog.conf and uncommented the # for
    pagespeed MessageBufferSize 100000;
    in pagespeedadmin.conf -following this guide- but nothing works :(

    Thank you!!
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
  10. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
    Are you using redis nginx level cache with wordpress behind cloudflare ? ngx_pagespeed isn't recommended with redis nginx level caching in that redis caching won't work due to ngx_pagespeed's use of no cache headers. But ngx_pagespeed should show headers still.
     
  11. cr0

    cr0 Member

    37
    2
    8
    Aug 21, 2017
    Ratings:
    +2
    Local Time:
    11:44 AM
    I can access the admin console, the issue is that stats aren't working. When I add

    PHP:
    pagespeed Statistics on;
    pagespeed StatisticsLogging on;
    pagespeed LogDir /var/log/pagespeed;
    to pagespeedadmin.conf, the error is gone but I receive a blank page.

    Yes! What do you suggest? To go with pagespeed + memcached or redis + wordpress cache plugins? Any other setup do you have in mind for wordpress?

    The best thing of pagespeed is that it minifies the photos, which any other plugin must be paid, right?

    Thanks!
     
  12. eva2000

    eva2000 Administrator Staff Member

    30,196
    6,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,144
    Local Time:
    7:44 PM
    Nginx 1.13.x
    MariaDB 5.5
    don't need to as the 3rd include file in vhost should have it in /usr/local/nginx/conf/pagespeedstatslog.conf
    Code (Text):
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    

    you would of uncommented/remove hash from these 3 lines

    for wordpress, keycdn cache enabler + wp plugins would work especially if you have cloudflare in front caching i.e. https://community.centminmod.com/threads/playing-with-ewww-image-optimizer-wordpress-plugin.12573/ (webp conversion)