mirror of https://github.com/djteang/OrangeTV.git
46 lines
1.5 KiB
Nginx Configuration File
46 lines
1.5 KiB
Nginx Configuration File
server {
|
|
listen 443 ssl;
|
|
server_name domain.com;
|
|
charset utf-8;
|
|
|
|
ssl_certificate /home/cert/tvcertificate.crt;
|
|
ssl_certificate_key /home/cert/tvprivate.pem;
|
|
|
|
location / {
|
|
proxy_pass http://ip:3003;
|
|
|
|
# 重要的代理头信息,让 Next.js 服务器知道原始请求的来源
|
|
proxy_set_header Host $host; # 原始主机名
|
|
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-Proto $scheme; # 原始协议 (http/https)
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Server $host;
|
|
}
|
|
location /ws-api {
|
|
proxy_pass http://ip:3001;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# WebSocket 特定的超时设置(长连接)
|
|
proxy_connect_timeout 7d;
|
|
proxy_send_timeout 7d;
|
|
proxy_read_timeout 7d;
|
|
|
|
# 禁用缓冲以减少延迟
|
|
proxy_buffering off;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
|
|
server_name domain.com;
|
|
|
|
return 301 https://domain.com$request_uri;
|
|
} |