Web / NGINX Interview questions
How do you enable Gzip compression in NGINX?
gzip on; gzip_types text/plain text/css application/json application/javascript text/xml; gzip_min_length 256; gzip_comp_level 5;
gzip_types restricts compression to text-based formats where it actually helps - compressing already-compressed formats like JPEG or MP4 wastes CPU for little benefit. gzip_min_length skips tiny responses where compression overhead isn't worth it.
The result is smaller response bodies over the wire, which speeds up page loads, especially on slower connections, at the cost of a small amount of CPU time on every request.
More Related questions...