版本是tengine 2.1.2, curl --range 0-1 http://1.test.com/test.tar.gz 返回的是整个文件; curl -I http://1.test.com/ 返回的响应头里也没有 Accept-Ranges: bytes
[alibaba/tengine]Tengine不支持断点续传吗?
回答
curl -I --range 0-1 http://1.test.com/test.tar.gz
麻烦看下返回的是什么头? 随便贴一下tengine的相关配置
root># curl -I --range 0-1 http://1.test.com/test.tar.gz HTTP/1.1 200 OK Server: Tengine/2.2.1 Date: Fri, 29 Sep 2017 01:57:31 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive 配置: root># cat nginx.conf
user www; worker_processes auto; worker_cpu_affinity auto; worker_rlimit_nofile 65535;
events { worker_connections 65535; reuse_port on; }
进程号保存文件pid /var/run/nginx.pid;
http {
文件扩展名与文件类型映射表include mime.types;
默认文件类型default_type text/html;
Log Formatlog_format main '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_x_app_name" "$http_user_agent" ' '"$http_x_forwarded_for" "$upstream_addr" "$upstream_status" "$request_time" "$upstream_response_time"';
日志文件access_log /dev/null; error_log logs/error.log notice;
keepalive_timeout 30; gzip on; gzip_min_length 1000; gzip_buffers 4 8k; gzip_types text/plain text/* text/css application/javascript application/x-javascript; gzip_comp_level 5; gzip_proxied any; gzip_vary on; gzip_http_version 1.0; output_buffers 4 32k; postpone_output 1460; client_header_buffer_size 128k; large_client_header_buffers 4 256k; client_header_timeout 1m; client_body_timeout 1m; send_timeout 1m; sendfile on; client_max_body_size 30m; client_body_buffer_size 30m;
charset utf-8; server_names_hash_bucket_size 512;
dyups_upstream_conf /usr/local/nginx/conf/upstream/.conf; include /usr/local/nginx/conf/upstream/.conf;
server
{
listen 80;
server_name 1.test.com;
client_max_body_size 50M;
gzip off;
location ~ ^/ {
root /mnt/;
access_log /usr/local/nginx/logs/mnt.log main;
error_log /usr/local/nginx/logs/mnt_err.log info;
}
}
}
怎么没有 Content-Length : http头截全了吗? /usr/local/nginx/logs/mnt_err.log 有没有什么错误?
看看这个文件和目录
ls -ld /mnt
ls -l /mnt/test.tar.gz
谢谢你的帮助,我发现是以下配置的问题:
support shtmlssi on; ssi_silent_errors on; ssi_types text/shtml;
我屏蔽掉以上配置后,再请求就可以了! root># curl --range 0-4 http://1.test.com/test.tar.gz -I HTTP/1.1 206 Partial Content Server: Tengine/2.2.1 Date: Fri, 29 Sep 2017 02:44:39 GMT Content-Type: text/html; charset=utf-8 Content-Length: 5 Last-Modified: Thu, 28 Sep 2017 08:32:22 GMT Connection: keep-alive ETag: "59ccb396-7b" Content-Range: bytes 0-4/123
不知道是什么原因这个SSI的配置导致这个问题的出现?
很多修改原始页面的模块都会关闭range功能,比如gzip也会。 我觉得是因为每次请求,返回的页面并不一样,比如gzip, 用range的话就会导致数据不对。