0
0
Nginxdevops~10 mins

First Nginx configuration - Interactive Code Practice

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

Complete the code to set the server to listen on port 80.

Nginx
server {
    listen [1];
}
Drag options to blanks, or click blank then click option'
A22
B443
C8080
D80
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 443 which is for HTTPS, not HTTP.
Using port 22 which is for SSH, not web traffic.
2fill in blank
medium

Complete the code to set the root directory for the website files.

Nginx
server {
    root [1];
}
Drag options to blanks, or click blank then click option'
A/var/log/nginx
B/etc/nginx
C/var/www/html
D/home/user
Attempts:
3 left
💡 Hint
Common Mistakes
Using /var/log/nginx which is for logs, not website files.
Using /etc/nginx which is for configuration files.
3fill in blank
hard

Fix the error in the location block to serve all requests with index.html.

Nginx
location / {
    try_files [1] =404;
}
Drag options to blanks, or click blank then click option'
A$uri/index.htm
B$uri $uri/ index.html
Cindex.html
D$uri/index.html
Attempts:
3 left
💡 Hint
Common Mistakes
Using only one file name without trying the URI first.
Using incorrect file extensions like .htm instead of .html.
4fill in blank
hard

Fill both blanks to create a server block that listens on port 8080 and serves files from /usr/share/nginx/html.

Nginx
server {
    listen [1];
    root [2];
}
Drag options to blanks, or click blank then click option'
A8080
B/var/www/html
C/usr/share/nginx/html
D80
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 80 instead of 8080 as requested.
Using the wrong root directory.
5fill in blank
hard

Fill all three blanks to create a location block that serves static files and sets the index file to index.html.

Nginx
location /static/ {
    root [1];
    index [2];
    autoindex [3];
}
Drag options to blanks, or click blank then click option'
A/var/www
Bindex.html
Con
Doff
Attempts:
3 left
💡 Hint
Common Mistakes
Setting autoindex to 'on' which shows directory contents.
Using wrong root path.