Challenge - 5 Problems
Nginx Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of the command to test Nginx configuration?
You have created a new Nginx configuration file. Which command will correctly test the syntax of this configuration and what will be the output if the syntax is correct?
Nginx
sudo nginx -t
Attempts:
2 left
💡 Hint
Use the command that checks Nginx configuration syntax without starting the server.
✗ Incorrect
The command 'sudo nginx -t' tests the syntax of the Nginx configuration files. If the syntax is correct, it outputs confirmation messages indicating success.
❓ Configuration
intermediate2:00remaining
Identify the correct server block to serve a static website on port 8080
You want Nginx to serve a static website from /var/www/html on port 8080. Which server block configuration is correct?
Attempts:
2 left
💡 Hint
The server block must listen on port 8080 and point root to the exact folder with index.html.
✗ Incorrect
Option B correctly sets the listen port to 8080, root directory to /var/www/html, and specifies index.html as the index file.
❓ Troubleshoot
advanced2:00remaining
Why does Nginx fail to start after adding a new server block?
You added this server block to your Nginx config but Nginx fails to start:
server {
listen 80;
server_name example.com;
root /var/www/example;
index index.html;
location / {
try_files $uri $uri/ =404
}
}
What is the cause of the failure?
Nginx
server {
listen 80;
server_name example.com;
root /var/www/example;
index index.html;
location / {
try_files $uri $uri/ =404
}
}Attempts:
2 left
💡 Hint
Check the syntax carefully for missing punctuation.
✗ Incorrect
Nginx requires semicolons at the end of directives. The 'try_files' line is missing a semicolon, causing a syntax error and preventing Nginx from starting.
🔀 Workflow
advanced2:00remaining
Order the steps to safely reload Nginx after configuration changes
Put these steps in the correct order to safely apply new Nginx configuration changes without downtime.
Attempts:
2 left
💡 Hint
You must edit first, then test, then reload, then check status.
✗ Incorrect
First edit the config, then test syntax, then reload Nginx to apply changes, finally check status to ensure it runs.
✅ Best Practice
expert2:00remaining
Which practice improves Nginx configuration maintainability?
You want to keep your Nginx configuration easy to manage as it grows. Which practice is best?
Attempts:
2 left
💡 Hint
Think about how to organize files for clarity and ease of updates.
✗ Incorrect
Using 'include' directives to split configuration into smaller files helps organize settings logically and makes maintenance easier.