mirror of
https://github.com/tmxk2021/CF-IPTV.git
synced 2025-12-19 00:05:19 +08:00
Update nginx.conf
This commit is contained in:
731
nginx.conf
731
nginx.conf
@@ -4,534 +4,211 @@ pid /run/nginx.pid;
|
|||||||
include /etc/nginx/modules-enabled/*.conf;
|
include /etc/nginx/modules-enabled/*.conf;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024; # 提高连接数上限
|
worker_connections 1024; # 提高连接数上限
|
||||||
multi_accept on; # 允许多连接同时接受
|
multi_accept on; # 允许多连接同时接受
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
##
|
||||||
##
|
# 基本设置
|
||||||
# 基本设置
|
##
|
||||||
##
|
sendfile on;
|
||||||
sendfile on;
|
tcp_nopush on;
|
||||||
tcp_nopush on;
|
tcp_nodelay on;
|
||||||
tcp_nodelay on;
|
keepalive_timeout 65;
|
||||||
keepalive_timeout 65;
|
keepalive_requests 1000; # 增加连接复用次数
|
||||||
types_hash_max_size 2048;
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
##
|
##
|
||||||
# SSL 设置
|
# SSL 设置
|
||||||
##
|
##
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
##
|
##
|
||||||
# 日志设置
|
# 日志设置
|
||||||
##
|
##
|
||||||
set_real_ip_from 0.0.0.0/0; # 允许所有代理传递真实 IP
|
set_real_ip_from 0.0.0.0/0; # 允许所有代理传递真实 IP
|
||||||
real_ip_header X-Forwarded-For;
|
real_ip_header X-Forwarded-For;
|
||||||
real_ip_recursive on;
|
real_ip_recursive on;
|
||||||
log_format custom '$remote_addr - $remote_user [$time_local] "$request" '
|
log_format custom '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
access_log /var/log/nginx/access.log;
|
access_log /var/log/nginx/access.log custom;
|
||||||
error_log /var/log/nginx/error.log;
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
##
|
##
|
||||||
# Gzip 压缩设置
|
# Gzip 压缩设置
|
||||||
##
|
##
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript video/mp2t;
|
gzip_disable "msie6";
|
||||||
|
gzip_vary on;
|
||||||
##
|
gzip_proxied any;
|
||||||
# 缓存路径配置
|
gzip_comp_level 6;
|
||||||
##
|
gzip_buffers 16 8k;
|
||||||
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cache_zone:10m max_size=500m inactive=24h use_temp_path=off;
|
gzip_http_version 1.1;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript video/mp2t application/vnd.ms-fontobject application/x-font-ttf font/opentype font/woff2 image/svg+xml image/x-icon;
|
||||||
##
|
|
||||||
# 虚拟主机配置
|
##
|
||||||
##
|
# 缓存路径配置
|
||||||
include /etc/nginx/conf.d/*.conf;
|
##
|
||||||
#include /etc/nginx/sites-enabled/*;
|
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cache_zone:10m max_size=500m inactive=24h use_temp_path=off;
|
||||||
|
|
||||||
server {
|
##
|
||||||
listen 20000;
|
# 虚拟主机配置
|
||||||
listen [::]:20000;
|
##
|
||||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
# include /etc/nginx/sites-enabled/*;
|
||||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
# 定义变量以简化配置
|
||||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
map $server_port $host_name {
|
||||||
|
20000 cdn.163189.xyz;
|
||||||
# 代理头设置
|
20001 cdn3.163189.xyz;
|
||||||
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
20002 cdn12.jdshipin.com;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
20003 cdn6.163189.xyz;
|
||||||
proxy_set_header Host cdn.163189.xyz; # 确保请求的 Host 匹配 Cloudflare 配置
|
20004 v2hcdn.jdshipin.com;
|
||||||
|
20005 edge3.hkdvb.com;
|
||||||
# SSL 配置
|
20006 cdn5.163189.xyz;
|
||||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
20007 cdn2.163189.xyz;
|
||||||
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
20008 aktv.top;
|
||||||
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
30001 www.stream-link.org;
|
||||||
proxy_ssl_server_name on;
|
30002 sc2025.stream-link.org;
|
||||||
|
30003 live-edge-06.stream-link.org;
|
||||||
# 默认缓存配置
|
}
|
||||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
|
||||||
proxy_cache_lock on; # 启用缓存锁
|
# 定义默认缓存配置
|
||||||
proxy_cache_valid 200 206 5s; # 默认对 200 和 206 状态码缓存 5 秒
|
proxy_cache_valid 200 206 5s;
|
||||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
proxy_cache_methods GET HEAD;
|
||||||
proxy_ignore_headers Cache-Control Expires; # 忽略上游响应的缓存控制头
|
proxy_ignore_headers Cache-Control Expires;
|
||||||
expires 5s; # 设置浏览器端缓存 5 秒
|
expires 5s;
|
||||||
|
|
||||||
# 默认 location 配置
|
# 服务器配置
|
||||||
location / {
|
server {
|
||||||
proxy_pass https://cdn.163189.xyz; # 替换为您的源站地址
|
listen 20000 default_server;
|
||||||
}
|
listen [::]:20000 default_server;
|
||||||
|
server_name $host_name; # 使用变量替换域名
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
# 启用 HTTP/2
|
||||||
proxy_pass https://cdn.163189.xyz; # 替换为您的源站地址
|
listen 443 ssl http2;
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
add_header X-Cache-Status $upstream_cache_status;
|
||||||
}
|
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||||
}
|
|
||||||
|
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
||||||
server {
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
||||||
listen 20001;
|
proxy_set_header Host $host_name; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||||
listen [::]:20001;
|
|
||||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
||||||
|
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
||||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
proxy_ssl_server_name on;
|
||||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
|
||||||
|
proxy_cache cache_zone; # 使用指定的缓存区域
|
||||||
# 代理头设置
|
proxy_cache_lock on; # 启用缓存锁
|
||||||
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
location / {
|
||||||
proxy_set_header Host cdn3.163189.xyz; # 确保请求的 Host 匹配 Cloudflare 配置
|
proxy_pass https://$host_name; # 使用变量替换源站地址
|
||||||
|
}
|
||||||
# SSL 配置
|
|
||||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
||||||
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
location ~* \.(ts|aac)$ {
|
||||||
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
proxy_pass https://$host_name; # 使用变量替换源站地址
|
||||||
proxy_ssl_server_name on;
|
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||||
|
expires 60s; # 设置浏览器端缓存 60 秒
|
||||||
# 默认缓存配置
|
}
|
||||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
|
||||||
proxy_cache_lock on; # 启用缓存锁
|
# 针对 .m3u8 文件内容修改
|
||||||
proxy_cache_valid 200 206 5s; # 默认对 200 和 206 状态码缓存 5 秒
|
location ~ \.m3u8$ {
|
||||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
proxy_pass https://aktv.top;
|
||||||
proxy_ignore_headers Cache-Control Expires; # 忽略上游响应的缓存控制头
|
|
||||||
expires 5s; # 设置浏览器端缓存 5 秒
|
# 替换为相对路径
|
||||||
|
sub_filter 'https://aktv.top/AKTV/stream/' '/AKTV/stream/';
|
||||||
# 默认 location 配置
|
sub_filter_once off;
|
||||||
location / {
|
sub_filter_types application/vnd.apple.mpegurl text/plain;
|
||||||
proxy_pass https://cdn3.163189.xyz; # 替换为您的源站地址
|
|
||||||
}
|
# 解压 gzip 压缩内容(如源站启用了压缩)
|
||||||
|
gzip off;
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
proxy_set_header Accept-Encoding "";
|
||||||
location ~* \.(ts|aac)$ {
|
}
|
||||||
proxy_pass https://cdn3.163189.xyz; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
# 针对 .m3u 文件内容修改
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
location ~ \.m3u$ {
|
||||||
}
|
proxy_pass https://www.stream-link.org;
|
||||||
}
|
|
||||||
|
# 替换为相对路径
|
||||||
server {
|
sub_filter 'https://sc2025.stream-link.org' 'http://$host:30002';
|
||||||
listen 20002;
|
sub_filter_once off;
|
||||||
listen [::]:20002;
|
# sub_filter_types application/vnd.apple.mpegurl text/plain;
|
||||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
|
||||||
|
# 解压 gzip 压缩内容(如源站启用了压缩)
|
||||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
gzip off;
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
proxy_set_header Accept-Encoding "";
|
||||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
}
|
||||||
|
|
||||||
# 代理头设置
|
# 针对包含 smt2.1.5.php 的 URL,设置缓存时间为 60 秒
|
||||||
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
location ~ smt2\.1\.5\.php {
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
proxy_cache_valid 200 206 60s; # 缓存 60 秒
|
||||||
proxy_set_header Host cdn12.jdshipin.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
expires 60s; # 设置浏览器缓存 60 秒
|
||||||
|
proxy_pass https://cdn12.jdshipin.com;
|
||||||
# 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;
|
server {
|
||||||
|
listen 30001;
|
||||||
# 默认缓存配置
|
listen [::]:30001;
|
||||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
server_name $host_name;
|
||||||
proxy_cache_lock on; # 启用缓存锁
|
|
||||||
proxy_cache_valid 200 206 5s; # 默认对 200 和 206 状态码缓存 5 秒
|
add_header X-Cache-Status $upstream_cache_status;
|
||||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||||
proxy_ignore_headers Cache-Control Expires; # 忽略上游响应的缓存控制头
|
|
||||||
expires 5s; # 设置浏览器端缓存 5 秒
|
proxy_set_header User-Agent "TiviMate/5.1.0";
|
||||||
|
proxy_set_header Referer "https://www.stream-link.org/";
|
||||||
# 默认 location 配置
|
proxy_set_header Host www.stream-link.org;
|
||||||
location / {
|
proxy_set_header Accept "*/*"; # 允许所有类型的内容
|
||||||
proxy_pass https://cdn12.jdshipin.com; # 替换为您的源站地址
|
proxy_set_header Connection "keep-alive";
|
||||||
}
|
|
||||||
|
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
||||||
location ~* \.(ts|aac)$ {
|
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
||||||
proxy_pass https://cdn12.jdshipin.com; # 替换为您的源站地址
|
proxy_ssl_server_name on;
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
proxy_cache cache_zone; # 使用指定的缓存区域
|
||||||
}
|
proxy_cache_lock on; # 启用缓存锁
|
||||||
|
|
||||||
# 针对包含 smt2.1.5.php 的 URL,设置缓存时间为 60 秒
|
location / {
|
||||||
location ~ smt2\.1\.5\.php {
|
proxy_pass https://www.stream-link.org; # 使用变量替换源站地址
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 60 秒
|
}
|
||||||
expires 60s; # 设置浏览器缓存 60 秒
|
}
|
||||||
proxy_pass https://cdn12.jdshipin.com;
|
|
||||||
}
|
# 其他服务器配置
|
||||||
}
|
server {
|
||||||
|
listen 30002;
|
||||||
server {
|
listen [::]:30002;
|
||||||
listen 20003;
|
server_name $host_name;
|
||||||
listen [::]:20003;
|
|
||||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
location / {
|
||||||
|
proxy_pass https://sc2025.stream-link.org;
|
||||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
proxy_set_header Host sc2025.stream-link.org;
|
||||||
add_header X-Cache-Status $upstream_cache_status;
|
proxy_set_header User-Agent "TiviMate/5.1.0";
|
||||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
proxy_set_header Referer "https://sc2025.stream-link.org/";
|
||||||
|
proxy_redirect ~https?://[^/]+(/.*) http://$host:30003$1;
|
||||||
# 代理头设置
|
}
|
||||||
proxy_set_header X-Real-IP $remote_addr; # 传递客户端真实 IP
|
}
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
proxy_set_header Host cdn6.163189.xyz; # 确保请求的 Host 匹配 Cloudflare 配置
|
server {
|
||||||
|
listen 30003;
|
||||||
# SSL 配置
|
listen [::]:30003;
|
||||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 指定 SSL 协议
|
server_name $host_name;
|
||||||
proxy_ssl_ciphers HIGH:!aNULL:!MD5; # 设置加密套件
|
|
||||||
proxy_ssl_verify off; # 忽略上游服务器证书验证
|
location / {
|
||||||
proxy_ssl_server_name on;
|
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_cache cache_zone; # 使用指定的缓存区域
|
proxy_set_header Referer "https://live-edge-06.stream-link.org/";
|
||||||
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://cdn6.163189.xyz; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
|
||||||
proxy_pass https://cdn6.163189.xyz; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 20004;
|
|
||||||
listen [::]:20004;
|
|
||||||
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 X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
proxy_set_header Host v2hcdn.jdshipin.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
|
||||||
|
|
||||||
# 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://v2hcdn.jdshipin.com; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
|
||||||
proxy_pass https://v2hcdn.jdshipin.com; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
listen 20006;
|
|
||||||
listen [::]:20006;
|
|
||||||
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 X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
proxy_set_header Host cdn5.163189.xyz; # 确保请求的 Host 匹配 Cloudflare 配置
|
|
||||||
|
|
||||||
# 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://cdn5.163189.xyz; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
|
||||||
proxy_pass https://cdn5.163189.xyz; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 20007;
|
|
||||||
listen [::]:20007;
|
|
||||||
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 X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
proxy_set_header Host cdn2.163189.xyz; # 确保请求的 Host 匹配 Cloudflare 配置
|
|
||||||
|
|
||||||
# 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://cdn2.163189.xyz; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
|
||||||
proxy_pass https://cdn2.163189.xyz; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 20008;
|
|
||||||
listen [::]:20008;
|
|
||||||
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 X-Real-IP $remote_addr; # 传递客户端真实 IP
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 支持多级代理
|
|
||||||
proxy_set_header Host aktv.top; # 确保请求的 Host 匹配 Cloudflare 配置
|
|
||||||
|
|
||||||
# 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://aktv.top; # 替换为您的源站地址
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 m3u8 文件内容修改
|
|
||||||
location ~ \.m3u8$ {
|
|
||||||
proxy_pass https://aktv.top;
|
|
||||||
|
|
||||||
# 替换为相对路径
|
|
||||||
sub_filter 'https://aktv.top/AKTV/stream/' '/AKTV/stream/';
|
|
||||||
sub_filter_once off;
|
|
||||||
sub_filter_types application/vnd.apple.mpegurl text/plain;
|
|
||||||
|
|
||||||
# 解压 gzip 压缩内容(如源站启用了压缩)
|
|
||||||
gzip off;
|
|
||||||
proxy_set_header Accept-Encoding "";
|
|
||||||
}
|
|
||||||
|
|
||||||
# 针对 .ts 和 .aac 文件的特殊缓存设置
|
|
||||||
location ~* \.(ts|aac)$ {
|
|
||||||
proxy_pass https://aktv.top; # 替换为您的源站地址
|
|
||||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
|
||||||
expires 60s; # 设置浏览器端缓存 60 秒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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