0
0
Nginxdevops~5 mins

Server block structure in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a server block in nginx?
A server block is a configuration section in nginx that defines how to handle requests for a specific domain or IP address. It tells nginx what to do when it receives a request for that server.
Click to reveal answer
beginner
Which directive defines the domain or IP address nginx listens to in a server block?
The server_name directive specifies the domain names or IP addresses that the server block will respond to.
Click to reveal answer
beginner
What is the purpose of the listen directive in a server block?
The listen directive tells nginx which IP address and port to listen on for incoming requests.
Click to reveal answer
beginner
How do you specify the folder where nginx should look for website files in a server block?
You use the root directive inside the server block or inside a location block to specify the folder path where the website files are stored.
Click to reveal answer
intermediate
What is the role of the location block inside a server block?
A location block defines how nginx should process requests for specific paths or URLs within the server block. It can control routing, proxying, or serving files.
Click to reveal answer
Which directive in an nginx server block specifies the domain names it should respond to?
Aserver_name
Blisten
Croot
Dlocation
What does the listen 80; directive do inside a server block?
ADefines the root folder for website files
BRedirects traffic to HTTPS
CSpecifies the domain name
DSets nginx to listen on port 80 for incoming requests
Where do you specify the folder path for website files in nginx?
AInside the <code>listen</code> directive
BInside the <code>root</code> directive
CInside the <code>server_name</code> directive
DInside the <code>error_page</code> directive
What is the purpose of a location block inside a server block?
ATo define how to handle requests for specific URL paths
BTo specify the server's IP address
CTo set the server's listening port
DTo define the server's domain name
Which of the following is NOT part of a typical nginx server block?
Aserver_name
Blisten
Cgit clone
Droot
Describe the main parts of an nginx server block and their roles.
Think about how nginx knows what domain to serve, where to listen, and where to find files.
You got /4 concepts.
    Explain how nginx uses the location block inside a server block to handle requests.
    Consider how different URLs might need different handling.
    You got /4 concepts.