Table of contents
Enable gzip
vim /etc/nginx/nginx.conf
gzip on;
** After gzip enabled **
Be aware when using request header: -H "Accept-Encoding: gzip, deflate"
curl http://domain.com/style.css
Outputs actual stylesheet
curl -H "Accept-Encoding: gzip, deflate" http;//domain.com/style.css
Outputs: Binary output can mess up your terminal
gzip config sample
event {...}
http {
include mine.type;
gzip on;
gzip_comp_level 3; #level 3 or 4 is good
gzip_types text/css; #define which type of file to compress
gzip_types text/javascript;
# test: curl -I -H "Accpet-Encoding: gzip, deflate" http://domain.com.style.css
# returns: > content-encoding: gzip
server {
listen 80;
server_name 198.255.25.1;
root /sites/demo;
}
}