mirror of
https://github.com/rad168/iptv.git
synced 2025-12-18 15:54:51 +08:00
Update nginx.conf
This commit is contained in:
503
mytv/nginx.conf
503
mytv/nginx.conf
@@ -1,791 +1,508 @@
|
||||
user www-data;
|
||||
|
||||
worker_processes auto;
|
||||
|
||||
pid /run/nginx.pid;
|
||||
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
|
||||
|
||||
events {
|
||||
|
||||
worker_connections 1024; # 提高连接数上限
|
||||
|
||||
multi_accept on; # 允许多连接同时接受
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
http {
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# 基本设置
|
||||
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
|
||||
tcp_nopush on;
|
||||
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
types_hash_max_size 2048;
|
||||
|
||||
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
default_type application/octet-stream;
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# SSL 设置
|
||||
|
||||
##
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# 日志设置
|
||||
|
||||
##
|
||||
|
||||
log_format custom '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# Gzip 压缩设置
|
||||
|
||||
##
|
||||
|
||||
gzip on;
|
||||
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript video/mp2t;
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# 缓存路径配置
|
||||
|
||||
##
|
||||
|
||||
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cache_zone:10m max_size=500m inactive=24h use_temp_path=off;
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# 虚拟主机配置
|
||||
|
||||
##
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
|
||||
|
||||
|
||||
server {
|
||||
|
||||
listen 20000;
|
||||
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
|
||||
|
||||
# 默认缓存配置
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass https://cdn.132.us.kg; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host cdn.132.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
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 秒
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
|
||||
|
||||
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_set_header Host cdn.132.us.kg;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
|
||||
location ~* \.(ts|aac)$ {
|
||||
|
||||
proxy_pass https://cdn.132.us.kg; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host cdn.132.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
|
||||
proxy_cache_methods GET HEAD;
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
|
||||
|
||||
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_set_header Host cdn.132.us.kg;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
|
||||
listen 20001;
|
||||
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
|
||||
|
||||
# 默认缓存配置
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass https://cdn3.132.us.kg; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host cdn3.132.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
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 秒
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
|
||||
|
||||
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_set_header Host cdn3.132.us.kg;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
|
||||
location ~* \.(ts|aac)$ {
|
||||
|
||||
proxy_pass https://cdn3.132.us.kg; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host cdn3.132.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
|
||||
proxy_cache_methods GET HEAD;
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
|
||||
|
||||
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_set_header Host cdn3.132.us.kg;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
|
||||
listen 20002;
|
||||
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
|
||||
|
||||
# 默认缓存配置
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass https://cdn.1689.us.kg; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host cdn.1689.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 10s; # 默认对 200 和 206 状态码缓存 5 秒
|
||||
|
||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
expires 10s; # 设置浏览器端缓存 5 秒
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
|
||||
|
||||
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_set_header Host cdn.1689.us.kg;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
|
||||
location ~* \.(ts|aac)$ {
|
||||
|
||||
proxy_pass https://cdn.1689.us.kg; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host cdn.1689.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
|
||||
proxy_cache_methods GET HEAD;
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
|
||||
|
||||
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_set_header Host cdn.1689.us.kg;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
|
||||
listen 20003;
|
||||
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
|
||||
|
||||
# 默认缓存配置
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass https://v2h.jdshipin.com; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host v2h.jdshipin.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用指定的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 10s; # 默认对 200 和 206 状态码缓存 10 秒
|
||||
|
||||
proxy_cache_methods GET HEAD; # 仅缓存 GET 和 HEAD 请求
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
expires 10s; # 设置浏览器端缓存 10 秒
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
|
||||
|
||||
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_set_header Host v2h.jdshipin.com;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
|
||||
location ~* \.(ts|aac)$ {
|
||||
|
||||
proxy_pass https://v2h.jdshipin.com; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host v2h.jdshipin.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
|
||||
proxy_cache_methods GET HEAD;
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
|
||||
|
||||
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_set_header Host v2h.jdshipin.com;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
|
||||
listen 20004;
|
||||
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
|
||||
|
||||
# 默认缓存配置
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass https://v2hcdn.jdshipin.com; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host v2hcdn.jdshipin.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
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 秒
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
|
||||
|
||||
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_set_header Host v2hcdn.jdshipin.com;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
|
||||
location ~* \.(ts|aac)$ {
|
||||
|
||||
proxy_pass https://v2hcdn.jdshipin.com; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host v2hcdn.jdshipin.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
|
||||
proxy_cache_methods GET HEAD;
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
|
||||
|
||||
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_set_header Host v2hcdn.jdshipin.com;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
|
||||
listen 20005;
|
||||
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
|
||||
|
||||
# 默认缓存配置
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass https://edge3.hkdvb.com; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host edge3.hkdvb.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
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 秒
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
# 固定请求头
|
||||
|
||||
proxy_set_header Host edge3.hkdvb.com;
|
||||
|
||||
proxy_set_header X-Real-IP 127.0.0.1;
|
||||
|
||||
proxy_set_header X-Forwarded-For 127.0.0.1;
|
||||
|
||||
proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0 (Edition GX-CN)";
|
||||
|
||||
proxy_set_header Referer "https://edge3.hkdvb.com/";
|
||||
|
||||
|
||||
|
||||
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_set_header Host edge3.hkdvb.com;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
|
||||
location ~* \.(ts|aac)$ {
|
||||
|
||||
proxy_pass https://edge3.hkdvb.com; # 替换为您的源站地址
|
||||
|
||||
proxy_set_header Host edge3.hkdvb.com; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
|
||||
proxy_cache_methods GET HEAD;
|
||||
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
|
||||
|
||||
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_set_header Host edge3.hkdvb.com;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 20006;
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
# 默认缓存配置
|
||||
location / {
|
||||
proxy_pass https://cdn5.1689.us.kg; # 替换为您的源站地址
|
||||
proxy_set_header Host cdn5.1689.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
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 秒
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
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_set_header Host cdn5.1689.us.kg;
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
location ~* \.(ts|aac)$ {
|
||||
proxy_pass https://cdn5.1689.us.kg; # 替换为您的源站地址
|
||||
proxy_set_header Host cdn5.1689.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
proxy_cache_methods GET HEAD;
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
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_set_header Host cdn5.1689.us.kg;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 20007;
|
||||
server_name cdn.1678520.xyz; # 替换为您的域名
|
||||
|
||||
# 默认缓存配置
|
||||
location / {
|
||||
proxy_pass https://cdn2.132.us.kg; # 替换为您的源站地址
|
||||
proxy_set_header Host cdn2.132.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
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 秒
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
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 $host; # 保留原始主机头
|
||||
|
||||
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_set_header Host cdn2.132.us.kg;
|
||||
|
||||
|
||||
# 针对 .ts 等文件的特殊缓存设置
|
||||
location ~* \.(ts|aac)$ {
|
||||
proxy_pass https://cdn2.132.us.kg; # 替换为您的源站地址
|
||||
proxy_set_header Host cdn2.132.us.kg; # 确保请求的 Host 匹配 Cloudflare 配置
|
||||
proxy_cache cache_zone; # 使用相同的缓存区域
|
||||
proxy_cache_lock on; # 启用缓存锁
|
||||
proxy_cache_valid 200 206 60s; # 缓存 .ts 文件 60 秒
|
||||
proxy_cache_methods GET HEAD;
|
||||
proxy_ignore_headers Cache-Control Expires;
|
||||
|
||||
# 自定义响应头:缓存命中状态和剩余缓存时间
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
add_header X-Cache-TTL $upstream_http_x_cache_ttl;
|
||||
|
||||
expires 60s; # 设置浏览器端缓存 60 秒
|
||||
|
||||
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_set_header Host cdn2.132.us.kg;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user