原链接为httpswwwbaiducom13m3u8 通过Nginx伪静态设置使链接变为httpswwwbaiducom13m3u8t=1642501421&sign=c4547a62f25cbd9f005c9e525a7a65cc 需要怎么设置Nginx
在 Nginx 的配置文件中,可以使用 rewrite 指令进行伪静态设置。具体操作步骤如下:
- 打开 Nginx 的配置文件,通常在 /etc/nginx/nginx.conf。
- 在 http 块中添加以下代码:
location ~ ^/(\d+)\.m3u8$ {
rewrite ^(.*)$ /$1?t=$msec&sign=c4547a62f25cbd9f005c9e525a7a65cc last;
}
其中,(\d+) 表示匹配数字,msec 是 Nginx 的内置变量,表示当前时间的毫秒数。
- 保存配置文件并重启 Nginx。
现在,访问 https://www.baidu.com/13.m3u8,就会自动带上 ?t=1642501421&sign=c4547a62f25cbd9f005c9e525a7a65cc 参数了。
原文地址: https://www.cveoy.top/t/topic/fH9U 著作权归作者所有。请勿转载和采集!