Link Search Menu Expand Document
Table of contents

Server push - improve the performance

Install nghttp2

apt-get install nghttp2-client

Test it …

nghttp -nys
    #only download one html 
nghttp -nysa
    #this will download all files 

configure nghttp2 server push

  • check the config file
  • once configured, run nghttp -nys
    • outputs 3 files, just like -nysa
    • reduction in process time and request time

Sample config

events {...}

http {
    include mine.type; 

    server {
        root /sites/demo; 

        # enable http2 
        listen 443 ssl http2;
        ssl_certificate /etc/nginx/ssl/self.crt;
        ssl_certificate_key /etc/nginx/ssl/self.key;

        # enable server_push 
        location = /index.html {
            http2_push /style.css;
            http2_push /thumb.png;