The root and alias instructions in the Nginx configuration are detailed

Source: Internet
Author: User

Both Root and alias can be defined in the location module, which is used to specify the true path of the requested resource, such as:

location/i/{
ROOT/DATA/W3;
}

When requesting http://foofish.net/i/top.gif this address, the real resource in the server is the/data/w3/i/top.gif file, noting that the real path is the value specified by root plus location specified value.


And the alias, like its name, alias specifies a path that is location alias, regardless of how the value of the location is written, the true path of the resource is the path specified by the alias, such as:

location/i/{
alias/data/w3/;
}

When the same request is http://foofish.net/i/top.gif, the resource path that is found on the server is:/data/w3/top.gif


Other differences:

The alias can only function in location, and root can exist in the server, HTTP, and location.
The alias must end with "/", otherwise the file will not be found, and root is optional for "/"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.