我有一个nginx服务器.我有很多图像 - pngs和jpgs保存为没有扩展名的文件(如"123123123_321312").
当我在html页面中使用标签"img"时,我会在控制台中收到这些消息:
Resource interpreted as Image but transferred with MIME type application/octet-stream: "http://xxxx/images/1350808948_997628". jquery.js:2 Resource interpreted as Image but transferred with MIME type application/octet-stream: "http://xxxx/images/1343808569_937350".
有没有办法让nginx添加标头与所请求文件的正确mimetype?
Mic*_*lif 17
您应该使用该default_type指令:
server {
...
default_type text/html;
location /images/png {
default_type image/png;
}
location /images/jpg {
default_type image/jpeg;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17403 次 |
| 最近记录: |