HTTP directives

alias directive (HTTP)

Changes the filesystem mapping for a location by replacing its matched URI portion with the configured path; distinct from root. Context: location. Regex locations require captures used in the alias. This is a preview, not part of the baseline lab.

Formal Syntax & Structure

nginx syntaxnginx
alias path;

Parameters & Attributes

NameTypeDescription
pathstringReplacement filesystem path.

Working Example

Example Snippetnginx
location /pictures/ {    alias html/assets/;}# /pictures/leaf.svg maps to html/assets/leaf.svg
Nginx Reference