Nginx反代m3u8资源加速HLS流媒体
现在很多直播源采用HLS流媒体传输协议,只需获得m3u8链接就可以在浏览器上播放,使用简单设备兼容性好。平时有些小众源速度跟不上卡顿,于是研究了下如何反代加速。起初在Github上找现成解决方案,不过类似项目很少且长时间没更新,测试用不了。索性试试Nginx反代,最终弄了个简单版。
反代方法
1. 安装Nginx和确保有http_sub_module替换模块。
2. 编辑Nginx虚拟机配置文件,加入反代规则。
# 适用任何符合指定后缀的请求 location ~* \.(m3u8|ts|aac)$ { proxy_cache off; # 禁用代理缓存 expires -1; # 禁用页面缓存 proxy_pass http://example.com; # 反代目标 URL sub_filter 'http://example.com/' 'http://$host/'; # 替换 m3u8 文件里的资源链接 sub_filter_last_modified off; # 删除原始响应里的浏览器缓存值 sub_filter_once off; # 替换所有匹配内容 sub_filter_types *; # 匹配任何 MIME 类型 }
3. 保存后运行nginx -t
命令检查语法是否有问题,避免添加到错误位置。
4. systemctl restart nginx
重启Nginx服务生效。之后就可以通过反代访问了。
例如原链接是http://example.com/hls/skynews/playlist.m3u8
,将域名改为你自己的,其它不变。
效果测试

hydroxychloroquine stock ticker https://hydroxychloroquine.webbfenix.com/
zovirax for shingles https://www.herpessymptomsinmen.org/productacyclovir/
best generic careprost reviews https://carepro1st.com/
ivermectin dosage humans https://ivermectin.webbfenix.com/
levitra vs vidalista for hardness https://vidalista.mlsmalta.com/
can clomiphene cause heart attack https://salemeds24.wixsite.com/clomid
azithromycin and strep throat https://keflex.webbfenix.com/
reviews on cialis daily http://www.lm360.us/
hydroxychloroquine 700 https://hydroxychloroquine.mlsmalta.com/
ivermectin cost https://ivermectin.mlsmalta.com/
brand viagra online canadian pharmacy http://droga5.net/
online pharmacy canada generic priligy https://ddapoxetine.com/
vidalista soft tabs review https://vidalista40mg.mlsmalta.com/
price of albuterol hfa inhaler https://amstyles.com/
how to use cialis daily https://wisig.org/
tadalafil liquid research chems https://tadalafil.cleckleyfloors.com/
ask a doctor free chat https://edmeds.buszcentrum.com/
ask a doctor free chat https://buymeds.mlsmalta.com/
chloroquine for sale online https://hydroxychloroquinee.com/
taking dapoxetine with dapoxetine https://dapoxetine.confrancisyalgomas.com/
over counter antibiotics at walmart https://amoxycillin1st.com/
prednisone 20 tablet https://bvsinfotech.com/
chewable cenforce soft tabs http://cavalrymenforromney.com/
I was wondering iff you ever considered changing the page layout of your site?
Its very well written; I love what youve gott to say.
But maybe you could a little more in the way of content
soo people could connect with it better. Youve goot an awful
lot of text for ojly hhaving 1 or two images. Maybe you could space it out
better?
Have a look at my page :: https://www.cheapdiamondpainting.com/happy-cats-diamond-painting.html