HTTP directives
location directive (HTTP)
Selects configuration for request URIs. Context: server or permitted nested location. No default. The displayed syntax covers common URI matching forms; named locations use a separate @name form. Exact, prefix and regex matching have distinct rules; nesting changes the selection details. Example is a partial configuration for the supplied isolated lab; do not paste it into a running host configuration.
Formal Syntax & Structure
nginx syntaxnginx
location [ = | ~ | ~* | ^~ ] uri { ... }Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| uri | string | URI pattern, optionally preceded by a matching modifier. |
Working Example
Example Snippetnginx
location = /about.html { root html;}