【发布时间】:2015-06-11 11:23:04
【问题描述】:
这是我的 nginx 站点配置文件:
server {
listen 81;
root /path/;
index index.php index.html index.htm;
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
access_log off;
expires 30d;
}
location /path/to/sounds {
add_header Content-Disposition "inline";
}
location / {
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include fastcgi_params;
}
}
我在特定文件夹中有几个 wav 文件:0001.wav、0002.wav、a.wav、b.wav...
页面应该播放这些文件,但在某些情况下(以字母开头的文件,例如 a.wav、b.wav)Chrome 正在下载它们。这很奇怪。
对于 a.wav 文件,Chrome 控制台日志显示:
Resource interpreted as Document but transferred with MIME type application/octet-stream:
虽然相同的控制台日志显示:
Resource interpreted as Document but transferred with MIME type audio/x-wav
我在同一台服务器上安装了 Apache。它适用于所有文件:
Resource interpreted as Document but transferred with MIME type audio/x-wav
我已经在/etc/nginx/mime.types中添加了:
audio/x-wav wav;
另外,我也换了
location /path/to/sounds {
到
location ~ \.wav$ {
这里有什么问题?
【问题讨论】:
标签: audio nginx mime-types