Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx http2 push

Discussion in 'Nginx and PHP-FPM news & discussions' started by upgrade81, Jul 19, 2019.

  1. upgrade81

    upgrade81 Premium Member Premium Member

    228
    14
    18
    Sep 5, 2016
    Switzerland
    Ratings:
    +20
    Local Time:
    8:41 PM
    1.17
    10.3
    Hi everyone,
    Is there a way to automatically push CSS and JS?
    If I use autoptimize or any other minifier, in case the name of the minified css file changes it is possible to automate the push?

    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:41 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  3. upgrade81

    upgrade81 Premium Member Premium Member

    228
    14
    18
    Sep 5, 2016
    Switzerland
    Ratings:
    +20
    Local Time:
    8:41 PM
    1.17
    10.3
    Do you have any advice for Wordpress?

    Using Lscache plugin + Litespeed it does everything automatically.
    On Centminmod (nginx) does not work also using lscache plugin with http2/push enable.
     
  4. fabianski

    fabianski Member

    99
    12
    8
    Feb 20, 2019
    Brazil
    Ratings:
    +31
    Local Time:
    3:41 PM
  5. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:41 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Nginx handles HTTP/2 push differently to Apache/LiteSpeed/OpenLitespeed so the litespeed cache plugin method won't work.

    For wordpress check out Better Resource Hints plugin to selective choose css and/or js files to preload first and then combine that with Nginx cache aware method of HTTP/2 Push outlined in links at https://community.centminmod.com/threads/nginx-1-13-9-release-with-http-2-server-push-support.14169/ which can turn preload hints into HTTP/2 push or use Better Resource Hints HTTP/2 push.
     
    • Like Like x 1
  6. sasiko

    sasiko Member

    41
    2
    8
    Aug 8, 2015
    Ratings:
    +8
    Local Time:
    8:41 PM
    1.8.0
    this does exactly what you want
    https://wordpress.org/plugins/http2-push-content/
     
    • Informative Informative x 3
  7. fabianski

    fabianski Member

    99
    12
    8
    Feb 20, 2019
    Brazil
    Ratings:
    +31
    Local Time:
    3:41 PM
  8. sasiko

    sasiko Member

    41
    2
    8
    Aug 8, 2015
    Ratings:
    +8
    Local Time:
    8:41 PM
    1.8.0
    Last edited: Aug 1, 2019
    • Like Like x 1
    • Informative Informative x 1
  9. upgrade81

    upgrade81 Premium Member Premium Member

    228
    14
    18
    Sep 5, 2016
    Switzerland
    Ratings:
    +20
    Local Time:
    8:41 PM
    1.17
    10.3
  10. sasiko

    sasiko Member

    41
    2
    8
    Aug 8, 2015
    Ratings:
    +8
    Local Time:
    8:41 PM
    1.8.0
    Ive never used redis myself so i cant help you much on that end. But have you tried disabling redis first just to confirm that your static files are being pushed
     
  11. upgrade81

    upgrade81 Premium Member Premium Member

    228
    14
    18
    Sep 5, 2016
    Switzerland
    Ratings:
    +20
    Local Time:
    8:41 PM
    1.17
    10.3
    did you configure anything at the nginx level?
     
  12. sasiko

    sasiko Member

    41
    2
    8
    Aug 8, 2015
    Ratings:
    +8
    Local Time:
    8:41 PM
    1.8.0
    no i didnt need to.
     
  13. nfn

    nfn New Member

    23
    0
    1
    Jun 28, 2015
    Ratings:
    +4
    Local Time:
    7:41 PM
    I'm using OLS with some WP websites because LSCWP is one of the most advanced free cache plugin I've found.
    The amount of features it has is huge and only accomplished with muitple plugins.

    I would prefer nginx but this is a great stack.
     
  14. sasiko

    sasiko Member

    41
    2
    8
    Aug 8, 2015
    Ratings:
    +8
    Local Time:
    8:41 PM
    1.8.0
    well you just cant blindly push all static files and assume it automatically make it load faster. if you make all files http2 push then the result would be same as without using push. only use push for the vital static files where you know it needs to appear first. example logos etc
     
    • Agree Agree x 1
  15. upgrade81

    upgrade81 Premium Member Premium Member

    228
    14
    18
    Sep 5, 2016
    Switzerland
    Ratings:
    +20
    Local Time:
    8:41 PM
    1.17
    10.3
    You're right, it's great!
    The only problem I noticed is the "Time spent downloading a page" which detects the Google crawler, it's twice as much as using centminmod with nginx.
    I don't know why yet.
     
  16. nfn

    nfn New Member

    23
    0
    1
    Jun 28, 2015
    Ratings:
    +4
    Local Time:
    7:41 PM
    I notice that too but since I use Cloudflare Cache Everything with +90% cache hit rate, the issue is minimized.

    Shouldn't be that hard to convert the rewrite rules to match nginx ones but then we loose the crawler feature for cache warmup.

    Hard choice!
     
  17. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,188
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,097
    Local Time:
    4:41 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Centmin Mod Nginx Wordpress + Cache Enabler full page cache vs Cybpanel Openlitespeed + LiteSpeed Wordpress cache way back https://community.centminmod.com/th...anel-openlitespeed-vs-centmin-mod-lemp.15144/. Also jump to mobile page speed comparison page speed tests as both Litespeed cache and Centmin Mod Cache enabler have mobile caching disabled so you can also see performance respectively when cache is not in play.
    • Haven't lots of options in a wordpress cache doesn't necessarily mean faster page load times especially if you're concerned with Google pagespeed focused metrics. It's knowing what optimisations to do and not what to do i.e. HTTP/2 push has advantages and disadvantages so you need to know which assets to push and when to push i.e. being HTTP/2 Push browser cache aware which most HTTP/2 Push implementations would not be. If HTTP/2 push isn't browser cache aware, then subsequent page loads after first page load will be slower.
    • I outlined how Centmin Mod Nginx HTTP/2 Push can be made browser cache conditionally aware at https://community.centminmod.com/threads/nginx-http-2-server-push-finally-supported.13986/.
    Google crawl page download time isn't much of an indicator for SEO and Google's determination of page speed. Use webpagetest.org and it's included google lighthouse tool for page speed testing. As it uses and allows you to test a variety of web browsers and mobile device browser and speed profiles. See my how to at WebPerf - PageSpeed - How to use webpagetest.org for page load speed testing and those are the metrics Google uses to determine page load speed.
     
  18. upgrade81

    upgrade81 Premium Member Premium Member

    228
    14
    18
    Sep 5, 2016
    Switzerland
    Ratings:
    +20
    Local Time:
    8:41 PM
    1.17
    10.3
    On this I disagree, especially on sites that deal strictly with news.

    However, only with litespeed I managed to reach the score of 90 from mobile with pagespeed-insights.
     
  19. nfn

    nfn New Member

    23
    0
    1
    Jun 28, 2015
    Ratings:
    +4
    Local Time:
    7:41 PM
    Good scores can be reached easily, the main problem are the advertisement for those who use it.