0
0
Nginxdevops~5 mins

Gzip configuration (types, min_length) in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the gzip directive do in nginx?
It enables or disables gzip compression for responses sent by the nginx server to clients.
Click to reveal answer
beginner
What is the purpose of the gzip_types directive in nginx?
It specifies the MIME types of responses that should be compressed using gzip.
Click to reveal answer
intermediate
How does the gzip_min_length directive affect gzip compression in nginx?
It sets the minimum size in bytes of a response that will be compressed. Responses smaller than this size will not be compressed.
Click to reveal answer
beginner
Give an example of a valid gzip_types configuration line in nginx.
gzip_types text/plain application/json application/javascript text/css;
Click to reveal answer
intermediate
Why might you want to set a higher gzip_min_length value?
To avoid compressing very small files where compression overhead might make the response larger or slow down delivery.
Click to reveal answer
What does the gzip_types directive control in nginx?
ACompression level used
BMinimum file size to compress
CWhich MIME types are compressed
DWhether gzip is enabled or disabled
If gzip_min_length is set to 1000, what happens to a 500-byte response?
AIt will be compressed
BIt will not be compressed
CIt will cause an error
DIt will be compressed only if gzip_types matches
Which directive enables gzip compression in nginx?
Agzip_min_length on;
Bgzip_types on;
Cgzip_enable on;
Dgzip on;
Which of these MIME types is commonly included in gzip_types?
Aapplication/javascript
Bimage/png
Cvideo/mp4
Dapplication/octet-stream
What is a reason to exclude very small files from gzip compression using gzip_min_length?
ACompression overhead can make them larger
BSmall files compress too well
CSmall files are always cached
DSmall files are already compressed
Explain how to configure nginx to compress JSON and CSS files only if they are larger than 500 bytes.
Think about enabling gzip, specifying types, and setting minimum length.
You got /3 concepts.
    Describe why setting the correct gzip_min_length value is important for web performance.
    Consider the trade-off between compression benefits and overhead.
    You got /4 concepts.