Challenge - 5 Problems
Nginx Modular Config Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the effect of this nginx config snippet?
Given this nginx configuration snippet, what will be the result when nginx starts?
http {
include /etc/nginx/conf.d/*.conf;
}Nginx
http {
include /etc/nginx/conf.d/*.conf;
}Attempts:
2 left
💡 Hint
The include directive supports wildcards to modularize configs.
✗ Incorrect
The include directive in nginx supports wildcards like *.conf to load multiple configuration files from a directory, allowing modular configuration.
❓ Configuration
intermediate2:00remaining
Choose the correct syntax to include a single config file
Which option correctly includes the file /etc/nginx/sites-enabled/example.conf inside the server block?
Nginx
server {
# include directive here
}Attempts:
2 left
💡 Hint
Include directive requires a semicolon at the end.
✗ Incorrect
The include directive syntax requires the path followed by a semicolon. Quotes are optional but not required.
❓ Troubleshoot
advanced2:00remaining
Why does nginx fail to start with this include?
You added this line to your nginx.conf:
But nginx fails to start with an error:
nginx: [emerg] open() "/etc/nginx/conf.d/invalid.conf" failed (2: No such file or directory)
What is the most likely cause?
include /etc/nginx/conf.d/*.conf;
But nginx fails to start with an error:
nginx: [emerg] open() "/etc/nginx/conf.d/invalid.conf" failed (2: No such file or directory)
What is the most likely cause?
Nginx
include /etc/nginx/conf.d/*.conf;Attempts:
2 left
💡 Hint
Check if all files matched by the wildcard exist.
✗ Incorrect
If any file matched by the wildcard does not exist or is a broken symlink, nginx will fail to start with an open() error.
🔀 Workflow
advanced3:00remaining
Order the steps to modularize nginx config using include
Put these steps in the correct order to modularize nginx configuration using the include directive:
Attempts:
2 left
💡 Hint
Think about creating directory before placing files and including them.
✗ Incorrect
First create the directory, then place config files inside, then add include directive, finally test and reload nginx.
✅ Best Practice
expert2:00remaining
Which practice is best for modular nginx config using include?
Which option is the best practice for organizing nginx configuration files using the include directive?
Attempts:
2 left
💡 Hint
Modular config helps maintainability and clarity.
✗ Incorrect
Using include with wildcards to load multiple small config files grouped logically is best practice for maintainability and clarity.