0
0
Nginxdevops~10 mins

Separate config files per site 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 include the site configuration file in nginx main config.

Nginx
include [1];
Drag options to blanks, or click blank then click option'
A/etc/nginx/conf.d/*.conf
B/etc/nginx/sites-available/*
C/usr/local/nginx/conf/*.conf
D/etc/nginx/sites-enabled/*
Attempts:
3 left
💡 Hint
Common Mistakes
Using sites-available instead of sites-enabled
Using conf.d which is for general configs
Using wrong directory paths
2fill in blank
medium

Complete the command to create a symbolic link for site1 config from sites-available to sites-enabled.

Nginx
ln -s [1] /etc/nginx/sites-enabled/site1.conf
Drag options to blanks, or click blank then click option'
A/usr/local/nginx/sites-available/site1.conf
B/etc/nginx/sites-enabled/site1.conf
C/etc/nginx/sites-available/site1.conf
D/etc/nginx/conf.d/site1.conf
Attempts:
3 left
💡 Hint
Common Mistakes
Linking from sites-enabled to sites-available
Using wrong source path
Confusing conf.d with sites-available
3fill in blank
hard

Fix the error in the server block to listen on port 80 for site2.

Nginx
server {
    listen [1];
    server_name site2.example.com;
    root /var/www/site2;
}
Drag options to blanks, or click blank then click option'
A8080
B80
C443 ssl
Dlocalhost
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 8080 which is non-standard
Using 443 without SSL config
Using 'localhost' which is invalid here
4fill in blank
hard

Fill both blanks to create a server block for site3 listening on port 443 with SSL enabled.

Nginx
server {
    listen [1] [2];
    server_name site3.example.com;
    root /var/www/site3;
}
Drag options to blanks, or click blank then click option'
A443
Bssl
C80
Dhttp2
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 80 for HTTPS
Omitting the ssl keyword
Using http2 without ssl
5fill in blank
hard

Fill all three blanks to create a location block that serves static files from /var/www/site4/static and disables logging.

Nginx
location [1] {
    root [2];
    access_log [3] off;
}
Drag options to blanks, or click blank then click option'
A/static
B/var/www/site4
Coff
D/var/www/site4/static
Attempts:
3 left
💡 Hint
Common Mistakes
Using full path in location instead of URL path
Setting root to static subfolder instead of base
Incorrect syntax for disabling access_log