0
0
Nginxdevops~10 mins

Contexts (main, events, http, server, location) in Nginx - Interactive Code Practice

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

Complete the code to define the main context in an Nginx configuration.

Nginx
user nginx;
worker_processes auto;
[1] {
    worker_connections 1024;
}
Drag options to blanks, or click blank then click option'
Aserver
Bhttp
Cevents
Dlocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'http' instead of 'events' for worker_connections.
Placing 'worker_connections' outside any context.
2fill in blank
medium

Complete the code to start the HTTP context in Nginx configuration.

Nginx
events {
    worker_connections 1024;
}

[1] {
    include mime.types;
    default_type application/octet-stream;
}
Drag options to blanks, or click blank then click option'
Ahttp
Bmain
Clocation
Dserver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'server' instead of 'http' for HTTP settings.
Placing 'include mime.types' outside the HTTP context.
3fill in blank
hard

Fix the error in the server block context declaration.

Nginx
http {
    [1] {
        listen 80;
        server_name example.com;
    }
}
Drag options to blanks, or click blank then click option'
Aserver
Blocation
Cevents
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'location' instead of 'server' inside HTTP.
Placing 'server' outside the HTTP context.
4fill in blank
hard

Complete the code to define a location block inside a server block.

Nginx
http {
    server {
        listen 80;
        server_name example.com;

        {BLANK_1}} /images/ { {
            root /data;
        }
    }
}
Drag options to blanks, or click blank then click option'
Alocation
Bserver
C{
D}
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'server' instead of 'location' for URL matching.
Forgetting the opening brace '{' after the location path.
5fill in blank
hard

Fill both blanks to complete a location block that matches the root URL and sets the root directory.

Nginx
http {
    server {
        listen 80;
        server_name example.com;

        {BLANK_1}} / { {
            {{BLANK_2}} /var/www/html;
        }
    }
}
Drag options to blanks, or click blank then click option'
Alocation
Broot
C{
Dserver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'server' instead of 'location' for the first blank.
Forgetting the opening brace '{' after the location path.
Placing 'root' outside the location block.