Table of contents
Server push - improve the performance
Install nghttp2
apt-get install nghttp2-client
Test it …
nghttp -nys https://example.com
#only download one html
nghttp -nysa https://example.com
#this will download all files
configure nghttp2
server push
- check the config file
- once configured, run
nghttp -nys https://example.com
- outputs 3 files, just like
-nysa
- reduction in process time and request time
- outputs 3 files, just like
Sample config
events {...}
http {
include mine.type;
server {
server_name 198.255.25.1;
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;
}
}
}