Adam is the topic of Ghost in the last two days. My blog is running on servers outside China, so to speed up access, enabling gzip compression is essential.
Vim/etc/nginx. conf
Find the code similar to the following:
Gzip on
Gzip_types text/plain
Just change it to the following:
Gzip on;
Gzip_buffers 4 16 k;
# Gzip_http_version 1.1;
Gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/javascript;
Gzip_comp_level 6;
Gzip_vary on;
Gzip_disable "MSIE ";
Gzip_proxied any;
You can use curl for testing, for example:
Curl-I-H "Accept-Encoding: gzip, deflate" "/assets/js/script. js"
Return
HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Tue, 01 Jul 2014 17:25:14 GMT
Content-Type: application/javascript
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: Express
ETag: "24792-1404232049000"
Cache-Control: public, max-age = 3600
Last-Modified: Tue, 01 Jul 2014 16:27:29 GMT
Content-Encoding: gzip
You can see that Content-Encoding: gzip is enabled.
If not, check whether the type in/etc/nginx/mime. types corresponds to gzip_types in nginx. conf.