0
0
Nginxdevops~20 mins

Gzip compression in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Gzip Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Check if gzip is enabled in nginx
You run the command nginx -T | grep gzip to check gzip settings. What output indicates gzip is enabled?
Nginx
nginx -T | grep gzip
Agzip off;
Bgzip on;
C# gzip on;
Dgzip_disable "msie6";
Attempts:
2 left
💡 Hint
Look for the directive that explicitly turns gzip on without being commented out.
Configuration
intermediate
2:00remaining
Configure gzip to compress only text files
Which nginx configuration snippet correctly enables gzip compression only for text-based files?
A
gzip on;
gzip_types text/plain text/css application/javascript;
B
gzip on;
gzip_types application/octet-stream;
C
gzip off;
gzip_types text/plain;
D
gzip on;
gzip_types image/png image/jpeg;
Attempts:
2 left
💡 Hint
gzip_types defines which MIME types are compressed. Text files have MIME types like text/plain or text/css.
Troubleshoot
advanced
2:30remaining
Why is gzip not compressing responses?
You enabled gzip in nginx but responses are still not compressed. Which of these is a likely cause?
AThe <code>Content-Length</code> header is missing in responses.
BThe <code>gzip_min_length</code> is set too low.
CThe <code>gzip_disable</code> directive disables gzip for the client browser.
DThe server is sending <code>Content-Encoding: gzip</code> header manually.
Attempts:
2 left
💡 Hint
Check if gzip is disabled for certain browsers or clients.
Best Practice
advanced
2:00remaining
Optimal gzip buffer size configuration
Which buffer size setting is recommended to optimize gzip compression performance in nginx?
Agzip_buffers 4 16k;
Bgzip_buffers 1 1k;
Cgzip_buffers 16 64k;
Dgzip_buffers 2 512k;
Attempts:
2 left
💡 Hint
Buffers should be moderate size to balance memory and compression efficiency.
🔀 Workflow
expert
3:00remaining
Order the steps to enable gzip compression in nginx
Put these steps in the correct order to enable gzip compression on an nginx server.
A2,1,3,4
B1,2,4,3
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
You must edit config before testing and reloading.