配置信息如下:
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
## 配置图片访问路径 --- alias
location /pic2/ {
alias F:/pictures/;
}
## 配置图片路径 --- root
location /pic/ {
root F:/pictures/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
上面的配置文件中存在两个访问图片的地址,但是最总的结果是只能访问带有alias 的文件,root 方式配置并未生效,
如图