mirror of
https://github.com/rad168/iptv.git
synced 2025-12-17 23:34:38 +08:00
Update nginx.conf
This commit is contained in:
137
mytv/nginx.conf
137
mytv/nginx.conf
@@ -269,51 +269,6 @@ http {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
listen 20005;
|
|
||||||
listen [::]:20005;
|
|
||||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
|
||||||
|
|
||||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
|
||||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
|
||||||
|
|
||||||
# 固定请求头
|
|
||||||
proxy_set_header User-Agent "TiviMate/5.1.0";
|
|
||||||
proxy_set_header Referer "https://edge3.hkdvb.com/";
|
|
||||||
proxy_set_header Host edge3.hkdvb.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
|
||||||
|
|
||||||
# 代理头设置
|
|
||||||
#proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
|
|
||||||
# SSL 配置
|
|
||||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
|
||||||
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
|
||||||
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
|
||||||
proxy_ssl_server_name on;
|
|
||||||
|
|
||||||
# 默认缓存配置
|
|
||||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
|
||||||
proxy_cache_lock on; # 启用缓存锁
|
|
||||||
proxy_cache_valid 200 206 5s; # 默认对 200 和 206 状态码缓存 5 秒
|
|
||||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
|
||||||
proxy_ignore_headers Cache-Control Expires; # 忽略上游响应的缓存控制头
|
|
||||||
expires 5s; # 设置浏览器端缓存 5 秒
|
|
||||||
|
|
||||||
# 默认 location 配置
|
|
||||||
location / {
|
|
||||||
proxy_pass https://edge3.hkdvb.com; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
|
||||||
proxy_pass https://edge3.hkdvb.com; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 20006;
|
listen 20006;
|
||||||
listen [::]:20006;
|
listen [::]:20006;
|
||||||
@@ -408,7 +363,7 @@ http {
|
|||||||
# 代理头设置
|
# 代理头设置
|
||||||
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
||||||
proxy_set_header Host aktv.top; # 确保请求的 Host 匹配 Cloudflare 配置
|
proxy_set_header Host aktv-stream.m16tv.cfd; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||||
|
|
||||||
# SSL 配置
|
# SSL 配置
|
||||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
||||||
@@ -426,15 +381,15 @@ http {
|
|||||||
|
|
||||||
# 默认 location 配置
|
# 默认 location 配置
|
||||||
location / {
|
location / {
|
||||||
proxy_pass https://aktv.top; # 替换为您的源站地址
|
proxy_pass https://aktv-stream.m16tv.cfd; # 替换为您的源站地址
|
||||||
}
|
}
|
||||||
|
|
||||||
# 针对 m3u8 文件内容修改
|
# 针对 m3u8 文件内容修改
|
||||||
location ~ \.m3u8$ {
|
location ~ \.m3u8$ {
|
||||||
proxy_pass https://aktv.top;
|
proxy_pass https://aktv-stream.m16tv.cfd;
|
||||||
|
|
||||||
# 替换为相对路径
|
# 替换为相对路径
|
||||||
sub_filter 'https://aktv.top/AKTV/stream/' '/AKTV/stream/';
|
sub_filter 'https://aktv-stream.m16tv.cfd/AKTV/stream/' '/AKTV/stream/';
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
sub_filter_types application/vnd.apple.mpegurl text/plain;
|
sub_filter_types application/vnd.apple.mpegurl text/plain;
|
||||||
|
|
||||||
@@ -445,7 +400,7 @@ http {
|
|||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
||||||
location ~* \.(ts|aac)$ {
|
location ~* \.(ts|aac)$ {
|
||||||
proxy_pass https://aktv.top; # 替换为您的源站地址
|
proxy_pass https://aktv-stream.m16tv.cfd; # 替换为您的源站地址
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
expires 60s; # 设置浏览器端缓存 60 秒
|
||||||
}
|
}
|
||||||
@@ -533,86 +488,4 @@ http {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
listen 30001;
|
|
||||||
listen [::]:30001;
|
|
||||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
|
||||||
|
|
||||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
|
||||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
|
||||||
|
|
||||||
# 固定请求头
|
|
||||||
proxy_set_header User-Agent "TiviMate/5.1.0";
|
|
||||||
proxy_set_header Referer "https://www.stream-link.org/";
|
|
||||||
proxy_set_header Host www.stream-link.org;
|
|
||||||
proxy_set_header Accept "*/*"; # 允许所有类型的内容
|
|
||||||
proxy_set_header Connection "keep-alive";
|
|
||||||
|
|
||||||
# 代理头设置
|
|
||||||
#proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
|
|
||||||
# SSL 配置
|
|
||||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
|
||||||
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
|
||||||
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
|
||||||
proxy_ssl_server_name on;
|
|
||||||
|
|
||||||
# 默认缓存配置
|
|
||||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
|
||||||
proxy_cache_lock on; # 启用缓存锁
|
|
||||||
proxy_cache_valid 200 206 5s; # 默认对 200 和 206 状态码缓存 5 秒
|
|
||||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
|
||||||
proxy_ignore_headers Cache-Control Expires; # 忽略上游响应的缓存控制头
|
|
||||||
expires 5s; # 设置浏览器端缓存 5 秒
|
|
||||||
|
|
||||||
# 默认 location 配置
|
|
||||||
location / {
|
|
||||||
proxy_pass https://www.stream-link.org; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 m3u 文件内容修改
|
|
||||||
location ~ \.m3u$ {
|
|
||||||
proxy_pass https://www.stream-link.org;
|
|
||||||
|
|
||||||
# 替换为相对路径
|
|
||||||
sub_filter 'https://sc2025.stream-link.org' 'http://$host:30002';
|
|
||||||
sub_filter_once off;
|
|
||||||
#sub_filter_types application/vnd.apple.mpegurl text/plain;
|
|
||||||
|
|
||||||
# 解压 gzip 压缩内容(如源站启用了压缩)
|
|
||||||
gzip off;
|
|
||||||
proxy_set_header Accept-Encoding "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 30002;
|
|
||||||
listen [::]:30002;
|
|
||||||
server_name cdn.1678520.xyz;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass https://sc2025.stream-link.org;
|
|
||||||
proxy_set_header Host sc2025.stream-link.org;
|
|
||||||
proxy_set_header User-Agent "TiviMate/5.1.0";
|
|
||||||
proxy_set_header Referer "https://sc2025.stream-link.org/";
|
|
||||||
proxy_redirect ~https?://[^/]+(/.*) http://$host:30003$1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 30003;
|
|
||||||
listen [::]:30003;
|
|
||||||
server_name cdn.1678520.xyz;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass https://live-edge-06.stream-link.org;
|
|
||||||
proxy_set_header Host live-edge-06.stream-link.org;
|
|
||||||
proxy_set_header User-Agent "TiviMate/5.1.0";
|
|
||||||
proxy_set_header Referer "https://live-edge-06.stream-link.org/";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user