Introduction
Nginx uses directives and blocks to control how it handles web traffic. Directives set simple rules, while blocks group related directives together to organize configuration clearly.
When you want to set a server's listening port and domain name.
When you need to define how to handle requests for different website paths.
When you want to group settings for a website inside a server block.
When you want to control caching or security settings for a specific location.
When you want to organize your configuration for easier reading and maintenance.