gzip
Enable Gzip in Amazon Linux
How to enable gzip on Plesk Nginx
To check if a web site have gzip enabled, run
1 |
curl -I -H 'Accept-Encoding: gzip,deflate' https://YOUR_DOMAIN.EXTN |
When you have no GZIP enabled, you will see error as follows
1 2 3 |
boby@hon-pc-01:~$ curl -I -H 'Accept-Encoding: gzip,deflate' https://serverok.in curl: (7) Failed to connect to serverok.in port 443: Connection refused boby@hon-pc-01:~$ |
With gzip enabled, you see something like following
1 2 3 4 5 6 7 8 9 10 11 12 |
boby@hon-pc-01:~$ curl -I -H 'Accept-Encoding: gzip,deflate' https://serverok.in HTTP/1.1 200 OK Server: nginx/1.10.3 (Ubuntu) Date: Sat, 23 Dec 2017 16:53:49 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Link: <https://news24.global/wp-json/>; rel="https://api.w.org/" Link: <https://news24.global/>; rel=shortlink Strict-Transport-Security: max-age=31536000; includeSubDomains Content-Encoding: gzip boby@hon-pc-01:~$ |
To enable gzip on nginx web server, i added following to server block
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
gzip on; gzip_comp_level 5; gzip_min_length 256; gzip_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype application/x-javascript application/x-web-app-manifest+json application/xhtml+xml application/xml font/eot font/opentype font/otf image/svg+xml image/x-icon image/vnd.microsoft.icon text/css text/plain text/javascript text/x-component; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; |