nginx v1.22.1
在反向代理 location 段加入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| location ^~ / { proxy_pass http://127.0.0.1:666; #强制响应 range 请求,对客户端返回 Accept-Ranges 响应标头及相关 206 状态码 proxy_force_ranges on; proxy_set_header Range $http_range; proxy_set_headerIf-Range $http_if_range; proxy_redirect off; 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 REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_http_version 1.1; # 大文件超时优化 proxy_connect_timeout 86400s; proxy_read_timeout 86400s; proxy_send_timeout 86400s; send_timeout 86400s; proxy_buffering off; client_max_body_size 0; proxy_request_buffering off; proxy_socket_keepalive on; }
|
这样,在处理文件上传的场景中,就不会因超时、文件太大,缓存太大等各种意外原因失败了,全改为边读边发,无缓存。