Complete the code to set the server to listen on port 80.
server {
listen [1];
}The listen directive tells Nginx which port to listen on. Port 80 is the default for HTTP.
Complete the code to set the root directory for the website files.
server {
root [1];
}/var/log/nginx which is for logs, not website files./etc/nginx which is for configuration files.The root directive sets the folder where Nginx looks for website files. /var/www/html is the common default.
Fix the error in the location block to serve all requests with index.html.
location / {
try_files [1] =404;
}The try_files directive tries the listed files in order. $uri $uri/ index.html tries the requested URI, then URI as a folder, then index.html.
Fill both blanks to create a server block that listens on port 8080 and serves files from /usr/share/nginx/html.
server {
listen [1];
root [2];
}Port 8080 is often used for testing or alternative HTTP ports. The root directory /usr/share/nginx/html is a common location for Nginx website files.
Fill all three blanks to create a location block that serves static files and sets the index file to index.html.
location /static/ {
root [1];
index [2];
autoindex [3];
}The root directive sets the base folder for static files. index sets the default file to serve. autoindex off disables directory listing for security.