If your site is running on Apache then click here to learn how to enable gzip compression. You can find out what web server your site is hosted on by going to BuiltWith and entering your URL (look for the “Web Server” section at the top).
More and more websites are now moving to Nginx web servers due to several performance and reliability updates over Apache. However, with these performance upgrades comes one particular downside – ease of use. Nginx servers aren’t quite as easy to configure as Apache but not to worry, we can still get them running at lightning fast speed in no time!
One of the best cost/performance improvements you can make to your website is to enable gzip compression/caching if it is not already enabled. This will massively reduce the amount of data transmitted from your web server, thus saving you bandwidth and improving load times. To enable gzip compression on Nginx simply do the following:
How to Enable Gzip Compression:
- Go to checkgzipcompression.com and check if gzip is currently enabled on your website. If it is then great, we’re done! However, the chances are it won’t be, so read on.
- If gzip isn’t enabled, locate your config file in your Nginx installation (named nginx.conf). To do this you will need FTP/SSH access to your host. You can find the file at one of the following locations (if you can’t find your Nginx configuration file in any of these locations then contact your host for help):
/etc/nginx/nginx.conf
/usr/local/nginx/conf/nginx.conf
/usr/local/etc/nginx/nginx.conf
- Add the following code to your nginx.conf file by copy & pasting it. We recommend using a suitable file editor such as Notepad++:
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
Congratulations, you’ve now enabled gzip on your Nginx web server! You can test if it is working by entering your URL on GTMetrix and looking at your result for the section “Enable gzip compression”. Your website visitors will thank you later for the extra speed boost.
Leave a Comment
You must be logged in to post a comment.