0
0
Nginxdevops~10 mins

Why understanding config structure is essential in Nginx - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the main configuration block in nginx.

Nginx
server {
    listen [1];
    server_name example.com;
}
Drag options to blanks, or click blank then click option'
A80
B22
C443
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 22 which is for SSH instead of HTTP port.
2fill in blank
medium

Complete the code to define the root directory for serving files.

Nginx
server {
    root [1];
    listen 80;
}
Drag options to blanks, or click blank then click option'
A/var/log/nginx
B/etc/nginx/conf.d
C/usr/share/nginx/html
D/home/user
Attempts:
3 left
💡 Hint
Common Mistakes
Setting root to a log or config directory which does not contain web files.
3fill in blank
hard

Fix the error in the location block to correctly serve static files.

Nginx
location /images/ {
    alias [1];
}
Drag options to blanks, or click blank then click option'
A/var/www/html/images
B/images
C/var/www/html
D/var/www/html/images/
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the trailing slash in alias path causing 404 errors.
4fill in blank
hard

Fill both blanks to correctly redirect HTTP to HTTPS.

Nginx
server {
    listen [1];
    return [2] https://$host$request_uri;
}
Drag options to blanks, or click blank then click option'
A80
B301
C302
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 443 for HTTP listen or wrong redirect code causing redirect loops.
5fill in blank
hard

Fill all three blanks to define a gzip compression configuration.

Nginx
gzip [1];
gzip_types [2];
gzip_min_length [3];
Drag options to blanks, or click blank then click option'
Aon
Btext/plain application/json
C1000
Doff
Attempts:
3 left
💡 Hint
Common Mistakes
Turning gzip off or missing required MIME types causing no compression.