Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Nginx 反向代理与负载均衡配置,包含 SSL 配置、流媒体代理、性能调优
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 55% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 162% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 155% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 59% | 0% |
提供 Nginx 反向代理、负载均衡、SSL 证书、流媒体代理(RTMP/HLS)和性能调优的配置模板。
使用 proxy_pass 转发请求,proxy_set_header 传递 Host/X-Real-IP/X-Forwarded-For。
配置 listen 443 ssl http2,指定证书路径。启用 TLSv1.2/1.3,配置 ssl_session_cache。HTTP 80 端口 301 重定向到 HTTPS。
upstream 块定义后端池,支持轮询(默认)、权重(weight)、IP哈希(ip_hash)。配置 max_fails/fail_timeout 健康检查。
需要 nginx-rtmp-module。rtmp 块配置 application live 直播,application hls 切片。HTTP 块配置 /hls 路径播放。
关键:proxy_http_version 1.1,proxy_set_header Upgrade/Connection "upgrade",proxy_read_timeout 86400。
worker_processes auto,worker_connections 10240,开启 sendfile/tcp_nopush/tcp_nodelay,gzip 压缩,client_max_body_size 50m。
| 问题 | 原因 | 解决方案 | |------|------|---------| | 502 Bad Gateway | 后端服务未启动 | 检查后端进程状态 | | 504 Gateway Timeout | 后端响应超时 | 增加 proxy_read_timeout | | SSL 证书不生效 | 路径错误 | 检查证书文件路径 | | WebSocket 断连 | 超时太短 | 增加 proxy_read_timeout | | 上传文件失败 | body 大小限制 | 增加 client_max_body_size | | RTMP 推流失败 | 模块未编译 | 重新编译带 rtmp 模块 |
Other measured skills in the registry, with their headline benchmark lift.