要配置Emby的反向代理,可以通过Nginx或Caddy实现,主要步骤包括反向代理设置、SSL证书配置和Emby服务器调整。主要目的是为了将比较差的Emby路线(别的)代理到比较好的路线上(你自己的),以下是具体方法:
proxy_pass地址):#PROXY-START/
location ~* \.(gif|png|jpg|css|js|woff|woff2)$ {
proxy_pass http://emby服务器IP:8096;
proxy_set_header Host $host;
expires 12h; # 静态资源缓存
}
location / {
proxy_pass http://emby服务器IP:8096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; # WebSocket支持
proxy_read_timeout 86400;
proxy_set_header X-Forwarded-For $remote_addr;
}
#PROXY-END/
关键配置包含:
server {
listen 443 ssl;
server_name your_domain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8096;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
emby.example.com {
gzip
proxy / localhost:8096 {
transparent
websocket
}
}
Caddy会自动申请并更新SSL证书,无需手动管理[3]。
通过以上配置,可实现:
不同方案的选择建议: