Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is Brotli compression in the context of nginx?
Brotli compression is a method to reduce the size of files sent from the server to the browser, making websites load faster. In nginx, it compresses responses before sending them to clients.
Click to reveal answer
beginner
Which nginx module is used to enable Brotli compression?
The ngx_brotli module is used to enable Brotli compression in nginx. It must be installed and configured to compress responses.
Click to reveal answer
intermediate
How do you enable Brotli compression for text and HTML files in nginx?
You enable Brotli by adding directives like 'brotli on;' and specifying file types with 'brotli_types text/plain text/css application/javascript text/html;' in the nginx configuration.
Click to reveal answer
intermediate
What is the benefit of using Brotli compression over gzip?
Brotli often compresses files to a smaller size than gzip, which means faster page loads and less data usage for users, improving website performance.
Click to reveal answer
beginner
What must you check before enabling Brotli compression in nginx?
You must check that the ngx_brotli module is installed and that your nginx version supports it. Also, ensure clients support Brotli compression.
Click to reveal answer
Which nginx directive turns on Brotli compression?
Abrotli_enable yes;
Bbrotli on;
Ccompress on;
Dgzip on;
✗ Incorrect
The correct directive to enable Brotli compression in nginx is 'brotli on;'.
What file types are commonly compressed with Brotli in nginx?
AImages like PNG and JPEG
BBinary executables
CText files like HTML, CSS, and JavaScript
DVideo files
✗ Incorrect
Brotli is typically used to compress text-based files such as HTML, CSS, and JavaScript to reduce size.
What is a key advantage of Brotli over gzip?
ABrotli only works on images
BBrotli compresses faster but less effectively
CBrotli is supported by fewer browsers
DBrotli compresses files smaller, improving load times
✗ Incorrect
Brotli usually compresses files to a smaller size than gzip, which helps websites load faster.
Before enabling Brotli, what should you verify?
AThat the ngx_brotli module is installed
BThat gzip is disabled
CThat the server is running Windows
DThat images are compressed
✗ Incorrect
You must ensure the ngx_brotli module is installed in nginx before enabling Brotli compression.
Which nginx directive specifies which file types Brotli compresses?
Abrotli_types
Bbrotli_files
Ccompress_types
Dgzip_types
✗ Incorrect
The 'brotli_types' directive tells nginx which MIME types to compress using Brotli.
Explain how to enable Brotli compression in nginx and why it improves website performance.
Think about the module, configuration lines, and the effect on file size and speed.
You got /5 concepts.
Describe the differences between Brotli and gzip compression in nginx.
Compare how well and fast each compresses and their compatibility.
You got /5 concepts.
Practice
(1/5)
1. What is the main purpose of enabling Brotli compression in Nginx?
easy
A. To increase the security of the website
B. To reduce file sizes and speed up website loading
C. To change the website's color scheme
D. To block unwanted visitors
Solution
Step 1: Understand Brotli compression purpose
Brotli compression is designed to reduce the size of files sent from the server to the browser.
Step 2: Connect compression to website speed
Smaller files load faster, improving website speed and user experience.
Final Answer:
To reduce file sizes and speed up website loading -> Option B
Quick Check:
Brotli compression = faster loading [OK]
Hint: Compression reduces file size to speed up loading [OK]
Common Mistakes:
Thinking Brotli improves security directly
Confusing compression with design changes
Assuming it blocks visitors
2. Which of the following is the correct way to enable Brotli compression in an Nginx configuration?
easy
A. brotli on;
B. brotli_enable on;
C. enable_brotli true;
D. brotli_compression = yes;
Solution
Step 1: Recall Nginx Brotli syntax
The correct directive to enable Brotli compression is brotli on;.
Step 2: Check other options for syntax errors
Options A, C, and D use incorrect directive names or syntax not valid in Nginx.
Final Answer:
brotli on; -> Option A
Quick Check:
Enable Brotli = brotli on; [OK]
Hint: Use exact directive 'brotli on;' to enable compression [OK]
Common Mistakes:
Adding extra words like 'enable' or 'compression'
Using '=' instead of ';' to end directive
Wrong directive names
3. Given this Nginx snippet, what will happen when a browser requests a CSS file?
B. CSS files will not be compressed because brotli_types is missing
C. CSS files will be compressed with Brotli at level 5
D. All files will be compressed regardless of type
Solution
Step 1: Analyze the configuration
Brotli is enabled with brotli on; and compression level set to 5.
Step 2: Check brotli_types directive
Only files with MIME type text/css will be compressed, so CSS files are included.
Final Answer:
CSS files will be compressed with Brotli at level 5 -> Option C
Quick Check:
brotli_types text/css = CSS compressed [OK]
Hint: brotli_types controls which file types get compressed [OK]
Common Mistakes:
Assuming all files compress without brotli_types
Thinking compression level disables Brotli
Ignoring MIME type filtering
4. You enabled Brotli in Nginx but notice no files are compressed. Which configuration mistake could cause this?
medium
A. Missing brotli on; directive
B. Setting brotli_comp_level to 0
C. Not specifying brotli_types for file types
D. Using brotli on without a semicolon
Solution
Step 1: Check syntax correctness
In Nginx, directives must end with a semicolon. Missing it causes config errors.
Step 2: Understand impact of missing semicolon
Without the semicolon, Nginx will fail to load the config properly, so Brotli won't work.
Final Answer:
Using brotli on without a semicolon -> Option D
Quick Check:
Missing semicolon breaks config [OK]
Hint: Always end Nginx directives with a semicolon [OK]
Common Mistakes:
Ignoring semicolon syntax errors
Assuming 0 disables compression but config still loads
Thinking brotli_types is mandatory to enable Brotli
5. You want to optimize Brotli compression for your website serving HTML, CSS, and JavaScript files. Which Nginx configuration snippet correctly enables Brotli for these types with maximum compression level?
hard
A. brotli on;\nbrotli_comp_level 11;\nbrotli_types text/html text/css application/javascript;
B. brotli on;\nbrotli_comp_level 5;\nbrotli_types image/png image/jpeg;
C. brotli enable;\nbrotli_level 11;\nbrotli_types text/html text/css application/javascript;
D. brotli on;\nbrotli_comp_level 11;\nbrotli_types text/plain text/xml;
Solution
Step 1: Identify correct directive names and values
Enable Brotli with brotli on; and set max compression level with brotli_comp_level 11;.
Step 2: Choose correct MIME types for HTML, CSS, JavaScript
Use text/html, text/css, and application/javascript in brotli_types.
Step 3: Eliminate incorrect options
The snippet starting with 'brotli enable;' uses invalid directive names ('brotli_level' instead of 'brotli_comp_level'). The snippet with 'image/png image/jpeg' targets unsuitable file types. The snippet with 'text/plain text/xml' uses wrong MIME types and misses JavaScript.
Final Answer:
brotli on;\nbrotli_comp_level 11;\nbrotli_types text/html text/css application/javascript; -> Option A