Welcome to Centmin Mod Community
Become a Member

Nginx nginx 1.13.9 - released

Discussion in 'Nginx and PHP-FPM news & discussions' started by pamamolf, Feb 21, 2018.

  1. eleshar

    eleshar New Member

    3
    1
    3
    Feb 22, 2018
    Ratings:
    +3
    Local Time:
    11:49 PM
    1.13.9
    10.2
  2. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Yeah it is.. wonder how adding QUIC into the mix will make things :)

    Interesting Centmin Mod 123.09beta01 and higher optionally support Nginx Lua but haven't tried that before. Probably easier to just use nginx native mapped cookie
     
  3. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    Have spent a few minutes on server push and fastcgi cached pages.

    HTTP/2 server push could or better should be a lot easier to setup.
    For example one single txt setup. uri ... push assets ....

    The current Server push Nginx setup opportunities are nice for a single CV website page but nothing more.

    As it won't work that simple for simple dynamic content with static assets.
    Where the assets are always the same (but page per page different).
    Only the text could change over time. In short, it should not be so difficult.

    To add a simple header to a Wordpress cached page.
    You now have to use a lot of extra nonsense. And that for only 1 header.

    For example fastcgi cached Wordpress test page.
    Code:
    location /about {
    add_header Link "</style.css>; as=style; rel=preload;";
    }
    Of course won't work as it can't find the source. Error 404.
    Code:
    location /about {
    try_files $uri $uri/ /index.php?$args;
    add_header Link "</style.css>; as=style; rel=preload;";
    }
    Seems to work fine at first sight.
    But there is one problem.
    And that is that it doesn't add the header.
    Code:
    location /about {
      add_header Link "</style.css>; as=style; rel=preload;";
      include fastcgi_params;
      fastcgi_pass php;
      fastcgi_cache_bypass $skip_cache;
      fastcgi_no_cache $skip_cache;
      fastcgi_cache WORDPRESS;
    }
    Works fine as long as it is cached.
    If the cache is expired bye bye page as it can't be cached again.
    Adding try_files $uri $uri/ /index.php?$args; result in the same problem as written above. Page loaded correctly but no header.

    Proxy pass and fastcgi pass results in bad gateway but that is due to the setup.
    The easiest solution should if uri then.
    Problem is that Nginx does not allow headers over there.
     
    Last edited: Feb 23, 2018
  4. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    probably need an nginx uri mapping of some kind ? but yeah using if statement doesn't allow add_header
     
  5. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    Won't work as if uri gets the same error.
    I am not a Nginx specialist and I only looked at it for a few minutes.
    But...what is more difficult than adding 1 header at 1 url. An thats it.
    Code:
    url /about
    add_header Link "</style.css>; as=style; rel=preload;";
    url /contact
    add_header Link "</style2.css>; as=style; rel=preload;";
    etc etc.
    
    You need to keep simple things simple.
    Just like Fastly's Varnish.
    Code:
    if (fastly_info.is_h2 && req.url ~ "^/contact")
      {
        h2.push("/assets/jquery.js");
    }
     
  6. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Just do mapping like the demo cookie for cache aware then. Assign uri map to variable like $page_uri and the set in vhosts
    Code (Text):
    location /about {
        add_header Link $page_uri;
    }
    
     
  7. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    Won't work as can be seen at Nginx - nginx 1.13.9 - released first example.
     
  8. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    Problem is simple yet annoying due to the limitations of Nginx.
    As Nginx is aggressive, it takes the / location too literally.

    Result it will break the CMS dynamic content as the CMS itself is directing the / location to its destination. The / location does not actually exist in a CMS other than /root or /.

    It is an index redirect i.e. /index.php?$args.
    And at that point, it goes wrong because both frustrate each other at all the locations other than root.

    For example location /contact
    Nginx can't find the content (error 404).
    And that is true because there is no /contact. It is /index.php?$args with the virtual location /contact.
    On his turn: The CMS can't redirect because the location is hard copied in Nginx.

    Nginx won't allow headers with if.
    With if uri add header problem would be solved in seconds.
     
    Last edited: Feb 23, 2018
  9. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    no of those linked examples use add_header LINK assigning a mapped variable though
     
  10. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    Thanks :). True. My mistake. But already tested.
    Problem is not the specific 'LINK assigning a mapped variable' it's the hard coded /location in combination with dynamic links. What causes the problem.
     
  11. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    I think i know what you mean location matching a wordpress generated page outside in separate location context. Keep at it.. you'll figure it out :)
     
  12. Andy

    Andy Premium Member Premium Member

    481
    77
    28
    Aug 6, 2014
    Ratings:
    +111
    Local Time:
    4:49 PM
    With every going on, is it safe to update yet? I hardly see a new nginx update with 5 pages of posts and it scares me.
     
  13. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    haha... we all updated days ago ;) what ya waiting for ? :D
     
  14. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    There will certainly be a solution.
    Wonder if it is my solution.

    It takes more time than a few minutes.
    For very little benefit.

    In addition, all examples from respective company's as Fastly, Nginx and Cloudflare are with static content only.

    With a recommendation not to use it with cached content, which fastcgi cache in fact is.
     
    Last edited: Feb 23, 2018
  15. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Yeah static content makes it easier though have you tried wordpress with keycdn cache enabler or wp super cache instead of fastcgi_cache ?

    As to benefit, HTTP/2 push is for optimising the first visit speed only and benefits are seen more on slower mobile device connections i.e. 3G as you're saving 1RTT on potentially 300+ ms RTT slow connections.
     
  16. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    Nup I don't use plug-ins on the Wordpress test site.

    Tried GitHub - horzadome/nginx_preloadheaders: nginx lua module for automatically determining resources which should be preloaded and for http2 server push
    It's great:). To great. It pushes way to aggressively.
    For example visiting the second page after the first.

    It will push all the assets, including images and fonts from page 1 to page 2, 3, 4 etc. Too bad there is no commitment to the project since Aug 25, 2016 anymore.

    Second it is running on Lua and Nginx.

    Lua Nginx has a problematic history with OpenSSL.
    Given the fact that a new OpenSSL around the corner with TLS 1.3.
    TLS 1.3 has my preference.
     
  17. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    ouch that ain't good !
    yeah there's work starting on Lua Nginx and OpenSSL 1.1 but don't think it's ready for prime time yet.
     
  18. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    About benefit and in particular server push on mobiles.

    As @eva2000 rightly pointed out. "benefits are seen more on slower mobile device connections". Biggest problem is the quality of the network performance. And that is with the current mobile technology. Quite changeable in some areas and/or on
    present-day phones:

    Conclusion:
    Source: http://papers.www2017.com.au.s3-website-ap-southeast-2.amazonaws.com/proceedings/p459.pdf
     
  19. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Same can be said for non-HTTP/2 pushed performance too when network performance is poor heh. One situation where HTTP/2 Push can be slower and elaborates on poor network performance is when you introduce packet loss into the equation. HTTP/2 Push gets slower as packet loss on a network rises as you get head of line blocking at the TCP level due to HTTP/2 having only one single multiplexed connection. You can test this using webpagetest.org advanced options which can simulate packet loss as well :)
     
  20. buik

    buik 'The greatest enemy of success is fear' Premium Member

    1,340
    372
    83
    Apr 29, 2016
    Flanders
    Ratings:
    +1,117
    Local Time:
    10:49 PM
    True.
    But the most important thing that matters to me.
    Even in the most ideal conditions, server push gives only minimal improvement.

    There are so many different types of devices and browsers that the ideal mix and settings for server push client go or no go is very difficult.

    What about your test results @eva2000 ? Both real life and via test pages as webpagetest.

    It takes far too much time, for too little improvement. As I speak for myself.
    Never Say Never Again. It will certainly be fine in the feature. It is only too early.
     
    Last edited: Feb 23, 2018
  21. eva2000

    eva2000 Administrator Staff Member

    46,013
    10,454
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,217
    Local Time:
    7:49 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Still long way off from proper testing - over time we shall see. Time wise doesn't seem to take that much time for me to implement seeing as I already use preload hints header just need to make it cache aware. But guess it depends on your setup.

    On 3G mobile test profiles my ideal target is under 1000-2000ms speedindex / first meaningful paint times (add another 1000-2000ms if you have 3rd party ads/analytics scripts). And as you know 3G mobile can have RTT of 300+ ms, so you can imagine a budget of 1000-2000ms means saving 1RTT 300+ ms on HTTP/2 Server Push is a huge deal.