Complete the code to set the server listening port to 8080.
server {
listen [1];
}The listen directive sets the port the server listens on. Here, 8080 is the correct port.
Complete the code to serve static files from the /var/www/html directory.
server {
root [1];
}The root directive defines the directory for static files. Here, /var/www/html is the standard web root.
Fix the error in the location block to correctly match requests for /images/.
location [1] {
root /var/www/html;
}The location block should match the path with a trailing slash to correctly serve files under /images/.
Fill both blanks to create a rewrite rule that redirects HTTP to HTTPS.
server {
listen 80;
server_name example.com;
return [1] https://[2]$request_uri;
}The return 301 sends a permanent redirect. Using $host preserves the requested hostname.
Fill all three blanks to create a location block that proxies requests to a backend server.
location [1] { proxy_pass [2]; proxy_set_header [3] $host; }
The location /api/ matches API requests. proxy_pass sends them to the backend server. proxy_set_header Host $host; forwards the original host header.