Compression in web servers is used to improve website loading performance, and is often measured and evaluated by search engines. Enabling gzip compression in Nginx is quite easy, since it’s already there in the main config file.
Just edit the /etc/nginx/nginx.conf file (or any other host file you have), and make it look like this:
By this, basically we told Nginx to enable gzip compression, set the memory buffers and told it what to compress (we wouldn’t want it to compress already compressed content, etc).
You can change the level of compression according to your CPU speed and needs. It takes a little experimenting to see which setting fits the server best.
service nginx restart