If you require gzip compression on responses with types other than text/html
, and you're running Nginx, you have to turn it on explicitly. To do so, you can add something like the following to a virtual host configuration file (usually located in /etc/nginx/sites-enabled
), inside the server
block:
server {
server_name example.com;
listen 80;
gzip on;
gzip_types text/plain application/xml text/css text/javascript application/javascript image/svg+xml application/json;
}
server_name example.com;
listen 80;
gzip on;
gzip_types text/plain application/xml text/css text/javascript application/javascript image/svg+xml application/json;
}
Remember to restart the server to load this change.