Complete the code to define the main context in an Nginx configuration.
user nginx; worker_processes auto; [1] { worker_connections 1024; }
The events context is used inside the main context to define worker connections and event handling.
Complete the code to start the HTTP context in Nginx configuration.
events {
worker_connections 1024;
}
[1] {
include mime.types;
default_type application/octet-stream;
}The http context contains settings for handling HTTP traffic, including MIME types and default content types.
Fix the error in the server block context declaration.
http {
[1] {
listen 80;
server_name example.com;
}
}The server context defines a virtual server inside the HTTP context.
Complete the code to define a location block inside a server block.
http {
server {
listen 80;
server_name example.com;
{BLANK_1}} /images/ { {
root /data;
}
}
}The location directive defines a location block, which must be followed by a path and an opening brace {.
Fill both blanks to complete a location block that matches the root URL and sets the root directory.
http {
server {
listen 80;
server_name example.com;
{BLANK_1}} / { {
{{BLANK_2}} /var/www/html;
}
}
}The location directive starts the block, followed by an opening brace {, and inside the block the root directive sets the directory for files.