0
0
Nginxdevops~20 mins

Gzip configuration (types, min_length) in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Gzip Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the effect of this gzip configuration snippet?
Given this nginx configuration snippet:
gzip on;
gzip_types text/plain application/json;
gzip_min_length 1000;

What happens when a client requests a JSON file of 800 bytes?
Nginx
gzip on;
gzip_types text/plain application/json;
gzip_min_length 1000;
AThe JSON file is sent uncompressed because its size is less than the gzip_min_length of 1000 bytes.
BThe JSON file is compressed only if the client supports gzip, regardless of size.
CThe JSON file is always compressed because gzip is enabled.
DThe JSON file is compressed before sending because its type matches and size is over 800 bytes.
Attempts:
2 left
💡 Hint
Check the minimum length setting and file size.
🧠 Conceptual
intermediate
2:00remaining
Which MIME types will be compressed with this configuration?
Consider this nginx gzip configuration:
gzip on;
gzip_types text/css application/javascript image/svg+xml;

Which of the following file types will be compressed?
Nginx
gzip on;
gzip_types text/css application/javascript image/svg+xml;
AFiles with MIME types text/css, application/javascript, and image/svg+xml will be compressed.
BOnly text/css and application/javascript files will be compressed; image/svg+xml is ignored.
CAll file types will be compressed because gzip is on.
DNo files will be compressed because gzip_types is missing text/html.
Attempts:
2 left
💡 Hint
gzip_types controls which MIME types are compressed.
Troubleshoot
advanced
2:00remaining
Why is gzip compression not applied to HTML files despite gzip on?
An nginx server has this configuration:
gzip on;
gzip_types text/css application/javascript;

Clients report HTML files are not compressed. Why?
Nginx
gzip on;
gzip_types text/css application/javascript;
Agzip_min_length is set too high for HTML files.
BHTML files are too small to be compressed by default.
Cgzip is off for HTML files by default.
DHTML files are not compressed because text/html is not included in gzip_types.
Attempts:
2 left
💡 Hint
Check which MIME types are listed in gzip_types.
Best Practice
advanced
2:00remaining
What is the recommended minimum gzip_min_length value to avoid compressing very small files?
Which gzip_min_length value is best to avoid wasting CPU compressing tiny files?
A20 (compress files larger than 20 bytes)
B1000 (compress files larger than 1000 bytes)
C100 (compress files larger than 100 bytes)
D0 (compress all files regardless of size)
Attempts:
2 left
💡 Hint
Small files often do not benefit from compression.
🔀 Workflow
expert
3:00remaining
Order the steps to enable gzip compression for JSON files larger than 500 bytes in nginx
Arrange these steps in the correct order to configure nginx to gzip compress JSON files only if they are larger than 500 bytes.
A3,1,2,4
B1,3,2,4
C1,2,3,4
D2,1,3,4
Attempts:
2 left
💡 Hint
Enable gzip first, then configure types and size, finally reload.