Join the community today
Register Now

IP.Board IPB Pagespeed Config

Discussion in 'Forum software usage' started by Jimmy, Mar 5, 2018.

  1. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Sweet. Thank @eva2000! :D
     
  2. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Code (Text):
    pagespeed Domain cdn.example.com;
    pagespeed LoadFromFile "https://cdn.example.com" "/home/nginx/domains/example.com/public";
    

    @eva2000 why would someone want to pull images out of a local image folder (let's assume that the /public is /uploads which is what I use) and sever them as images from cdn.example.com?

    My CDN is pulling a files from the uploads directory on my server. That entire folder is already on the cdn's server.

    I wonder how useful pagespeed is when using a CDN. The CDN is already dealing with the css and image files, unless pagespeed is going to optimize those resources even more.
     
    Last edited: Mar 13, 2018
  3. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
  4. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    You're telling ngx_pagepseed to allow optimising css, js, and images from the cdn Domain you listed and allow CDN to serve those optimised assets. CDN's generally don't auto optimise/minify static assets and resize/optimise image sizes unless they have such settings i.e. Cloudflare.
     
  5. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    1. Found an issue when clicking on the hide post. Modal pops up, but no option to enter the reason or button to actually hide the content. With PS off, it works.

    2. @eva2000 I'm not understanding which is the best way to do this. I guess your way is correct, because I just turned off ps and got the error below. Never got that before running the config without the LoadFile options.

    Code:
    # pscontrol off
    rm: cannot remove ‘/var/ngx_pagespeed_cache/v3/example.com/https,3A/,2Fcdn.example.com/uploads’: Directory not empty
    systemctl restart nginx.service
    
    3. Not sure I'd run this in a production environment until more testing. My registrations dropped by a lot yesterday (day after I started using it) not sure if PS is blocking something or what.
     
    Last edited: Mar 15, 2018
  6. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you running command as full root user ? as you shouldn't get that though i do see ascii characters wrapping in early single quotes instead. Make sure your SSH client encoding is set to UTF-8.
     
  7. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Are you referring to the client I use on my computer? If so, everything is set to UTF-8.

    It's probably something in my conf file because I was running the CMM stock version with no issues.
     
  8. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yeah could be as never had that issue and here's pscontrol off code lines nothing i see should cause that if running commands as root user centminmod/centminmod
     
  9. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Haven't tested this out yet, but I believe these are the correct lines:

    Code:
    # Enable rewrite_domains when using CDN.
    pagespeed EnableFilters rewrite_domains;
    
    # Information on Origin Pull CDNs
    # https://www.webfoobar.com/node/79
    
    # DOMAIN1.COM INFO
    pagespeed Domain https://domain1.com;
    pagespeed MapRewriteDomain https://cdn.domain1.com https://domain1.com;
    pagespeed Disallow  "https://domain1.com/<admin_folder>/*";
    pagespeed Disallow  "https://domain1.com/admin/*";
    pagespeed Disallow  "https://domain1.com/*do=quote*";
    pagespeed Disallow  "https://domain1.com/page/index.html";
    
    # DOMAIN1.COM INFO
    pagespeed Domain https://domain2.com;
    pagespeed MapRewriteDomain https://cdn.domain2.com https://domain2.com;
    pagespeed Disallow  "https://domain2.com/<admin_folder>/*";
    pagespeed Disallow  "https://domain2.com/admin/*";
    pagespeed Disallow  "https://domain2.com/*do=quote*";
    pagespeed Disallow  "https://domain2.com/page/index.html";
     
    • Informative Informative x 1
  10. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Have it running in production without issues, so far.
     
    • Like Like x 1
  11. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Well, that's config isn't working. Randomly switching images when the image uses the IPB image proxy.
     
  12. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    what you do mean ? example ?
     
  13. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    Not really much else to say. The image is replaced w/ another image from the site.

    1. The user creates a thread.
    2. Pastes in some text along with a few images from another source.
    3. IPB uses an image proxy so that all images will be https when viewed.
    Code:
    https://example.com/applications/core/interface/imageproxy/imageproxy.php?img=https://somesite.com/image/something.jpg
    4. Image above gets randomly replaced by an image from another thread. When pagespeed is turned off, it works fine.

    Not sure if the image proxy is messing something up. There's pagespeed, a CDN, and a proxy. A lot of stuff going on.
     
    Last edited: Mar 22, 2018
  14. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    it's because proxy image ends in image extension that pagespeed picks up i.e. something.jpg

    Just exclude / disallow the imageproxy.php file from ngx_pagespeed
    Code (Text):
    pagespeed Disallow */imageproxy/imageproxy.php*;
    
     
    • Agree Agree x 1
  15. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    :D After I typed my last post it dawned on me to do exactly what you said.

    We'll give that a try and see what happens.
     
  16. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    I wonder if it's better to include the line in each domain vs. one line like you have above?

    Code:
    # DOMAIN1.COM INFO
    pagespeed Domain https://domain1.com;
    pagespeed MapRewriteDomain https://cdn.domain1.com https://domain1.com;
    pagespeed Disallow  "https://domain1.com/applications/core/interface/imageproxy/*";
    pagespeed Disallow  "https://domain1.com/admin/*";
    pagespeed Disallow  "https://domain1.com/*do=quote*";
    pagespeed Disallow  "https://domain1.com/page/index.html";
     
  17. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    i just use what i posted wildcard.. if you ever have more than one forum on same server, that would exclude them all
     
  18. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    I was more worried about the "pagespeed Domain" lines and if your line needed to be at the end of the file after the "pagespeed Domain" or before the "pagespeed Domain" lines.
     
  19. Jimmy

    Jimmy Premium Member Premium Member

    1,351
    285
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +696
    Local Time:
    4:00 AM
    1.13.x
    MariaDB 10.1.x
    https://www.modpagespeed.com/doc/restricting_urls

    So, I guess putting it at the end of the file is best.

    Since wildcards can be used, I can reduce the number lines in the conf file.
     
    • Agree Agree x 1
  20. eva2000

    eva2000 Administrator Staff Member

    35,624
    7,844
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,093
    Local Time:
    6:00 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yes order matters :)
     
    • Agree Agree x 1
..