gpt4 book ai didi

audio - Nginx:如何避免在所有WAV文件中强制下载?

转载 作者:行者123 更新时间:2023-12-02 22:23:00 26 4
gpt4 key购买 nike

这是我的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$ {

怎么了

最佳答案

解决了:

我添加到了mime.types文件中:

 audio/x-wav                wav;

在我的nginx配置中:
location ~ \.wav$ {
add_header Content-Disposition "inline";
}

关于audio - Nginx:如何避免在所有WAV文件中强制下载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30779412/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com