Objective
When you recently deployed the Log Analysis tool Awstats on Nginx, when configuring Awstats analysis results for web browsing, Analysis results page access is always 404. Later looked at some data, found that the use of root and alias difference did not understand the cause, here specifically will be the difference between the two detailed way, for everyone to learn reference.
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;
}
http://foofish.net/i/top.gif
when requesting this address, the real resource in the server is the /data/w3/i/top.gif
file
Note: The true path is the value specified by root plus the value specified by location.
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/;
}
At the same request http://foofish.net/i/top.gif
, the resource path that is found at the server is: /data/w3/top.gif
Other differences:
1, the alias can only function in location, and root can exist in the server, HTTP and location.
2, the alias must be followed by the "/" end, or you will not find the file, and root is "/" optional.
Summarize
The above is the entire content of this article, I hope to be able to learn or work to bring certain help, if you have questions you can message exchange