root:
location /request_path/image/ {
root /local_path/image/;
}
The root will be mapped according to the full URI request, which is /path/uri.
When the client requests /request_path/image/cat.png, Nginx maps the request to /local_path/image/request_path/image/cat.png
alias:
location /request_path/image/ {
alias /local_path/image/;
}
alias will discard the path configured after location and point the currently matched directory to the specified directory.
When the client requests /request_path/image/cat.png, Nginx maps the request to /local_path/image/cat.png
1. When using alias, be sure to add "/" after the directory name.
2. alias can specify any name.
3. The alias can only be in the location block.