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 "/"