Web / NGINX Interview questions
What are the types of context blocks in NGINX configuration?
NGINX configuration is organized into nested context blocks, each controlling directives for a specific scope:
main- top-level context, outside any braces; sets global settings like worker processes and user.events- configures connection handling, such asworker_connections.http- wraps all HTTP-related configuration.server- defines a virtual host insidehttp.location- matches specific request URIs inside aserverblock.upstream- defines a named group of backend servers for proxying.
Directives set in an outer context are inherited by inner ones unless explicitly overridden, which is why global settings like gzip on; are often placed in http rather than repeated in every server block.
More Related questions...