浏览 845
在用nginx配置m3u8视频播放的时候,使用到accesskey防盗链。然后提示了标题错误。
网上查到的解决办法是配置文件编码问题,然后修改编码后还是存在这个问题。请社区大佬看一下这个问题怎么解决
配置文件如下:
server {
listen 90;
server_name 127.0.0.1;
location /video {
accesskey on;
accesskey_hashmethod md5;
accesskey_arg "key";
accesskey_signature "password127.0.0.1/1";
alias D:/video/;
}
}
upstream video_server_pool{
server 127.0.0.1:90 weight=10;
}
server {
listen 80;
server_name test.nginxtest.com;
location /video {
types{
application/x-mpegURL m3u8;#关键配置
video/mp2t ts;#关键配置
}
proxy_pass http://video_server_pool;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Methods POST,GET,OPTIONS,DELETE,PUT;
add_header Access-Control-Allow-Headers X-Requested-With;
}
}
配置文件中的域名是在本地的host配的。
操作系统为win10
按点赞数排序
按时间排序
accesskey为nginx第三方模块指令,需要安装nginx第三方模块ngx_http_accesskey_module。我下载的
https://github.com/Martchus/nginx-accesskey,测试通过,--add-module=/home/lq/work/nginx-accesskey(模块源码路径)必须指定,其他参数根据自己情况而定。
Ubuntu18.04编译参数如下:./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --add-module=/home/lq/work/tongmingzhiyun/openresty/lua-nginx-module-0.10.21 --add-module=/home/lq/work/tongmingzhiyun/openresty/ngx_devel_kit-0.3.1 --add-module=/home/lq/work/nginx-accesskey
0
回答于2022-10-31 14:00