想访问 http://example.com/a.png,解析出来的是 HTML 内容并执行,而不是 png 图片。
可是分别设置如下 location,只有 /test/ 这个 location 成功了。
location /test/ {
default_type text/html;
types {
text/html png;
}
}
location \.png {
default_type text/html;
types {
text/html png;
}
}
官网文档也没有讲清楚:
http://nginx.org/en/docs/http/ngx_http_core_module.html#types
请问重设 Nginx 的 Content-Type 只能针对目录吗?不能针对以特定后缀结尾的 URL 吗?