Mastering Nginx

(Ron) #1

The NGINX HTTP Server


[ 124 ]

The following table summarizes these directives:


Table: HTTP file-path directives

Directive Explanation
disable_symlinks Determines if NGINX should perform
a symbolic link check on the path to a
file before delivering it to the client. The
following parameters are recognized:


  • off: Disables checking for symlinks
    (default)

  • on: If any part of a path is a symlink,
    access is denied

  • if_not_owner: If any part of a
    path contains a symlink in which the
    link and the referent have different
    owners, access to the file is denied

  • from=part: When specified, the
    path up to part is not checked for
    symlinks, everything afterward is
    according to either the on or if_
    not_owner parameter
    root Sets the path to the document root. Files are
    found by appending the URI to the value of
    this directive.
    try_files Tests the existence of files given as
    parameters. If none of the previous files are
    found, the last entry is used as a fallback, so
    ensure that this path or named location
    exists, or is set to return a status code
    indicated by =.


Name resolution


If logical names instead of IP addresses are used in an upstream or *_pass directive,


NGINX will by default use the operating system's resolver to get the IP address, which


is what it really needs to connect to that server. This will happen only once, the first
time upstream is requested, and won't work at all if a variable is used in the *_pass


directive. It is possible, though, to configure a separate resolver for NGINX to use. By
doing this, you can override the TTL returned by DNS, as well as use variables in the


*_pass directives.

Free download pdf