Koskamo

Configuration structure and server blocks

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

nginx runs one master process, which reads and evaluates configuration and maintains worker processes, and several worker processes that actually process requests using an event-based model. Configuration lives in a file named nginx.conf by default, placed in /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx. nginx consists of modules controlled by directives: a simple directive is a name and parameters ending with a semicolon, while a block directive ends with braces and, when it can hold other directives inside, is called a context — events, http, server, and location are examples. Directives outside any context belong to the main context; events and http reside in main, server in http, and location in server. The rest of a line after the # sign is a comment. A configuration can include several server blocks distinguished by the ports they listen on and by server names; once nginx decides which server processes a request, it tests the request URI against that server's location directives and selects the one with the longest matching prefix. Scope: nginx. Reviewed October 4, 2026.

Source and provenance

Original source
nginx.org
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.