之前的配置是這樣,結果按配置路徑訪問報404
處理方法兩種配置路徑方法如下:
1.
location /image/ {
root /usr/local/;
autoindex on;
}
2.
location /image/ {
alias /usr/local/image/;
autoindex on;
}
總結:
root響應的路徑:配置的路徑(root指向的路徑)+完整訪問路徑(location的配置路徑)+靜態文件
alias響應的路徑:配置的路徑+靜態文件(去除location中配置的路徑)
一般情況下,在location /中配置root,在location /other中配置alias