nginx挂起通过代理服务video

我正在使用nginx-proxy将stream量路由到Dockerised站点的分段和实时环境,所有站点都运行在同一台主机上。 这些代理虚拟主机的一些额外的nginxconfiguration将静态文件路由到S3存储桶。

除了video文件,一切工作正常。 请求只是“挂起”,我没有得到任何回应,任何超时..什么。 下面的片段涉及到一个示例video文件,但是在那里有几个都是一样的。 任何其他文件types – JS,CSS,PNG,JPG – 都可以正常加载。

示例请求:

curl -v http://staging.mysite.com/static/video/video.mp4 * Trying ***.***.***.***... * TCP_NODELAY set * Connected to staging.mysite.com (***.***.***.***) port 80 (#0) > GET /static/video/video.mp4 HTTP/1.1 > Host: staging.mysite.com > User-Agent: curl/7.51.0 > Accept: */* > 

而已。 Curl只会坐在那里等待回应。

针对上述请求的Nginx日志条目:

 nginx.1 | staging.mysite.com ***.***.***.*** - - [09/Jun/2017:12:55:42 +0000] "GET /static/video/video.mp4 HTTP/1.1" 200 144056 "-" "curl/7.51.0" 

代理上/etc/nginx/nginx.conf内容:

 user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { server_names_hash_bucket_size 128; include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; } daemon off; 

代理中/etc/nginx/conf.d/default.conf中唯一的文件)的内容:

 map $http_x_forwarded_proto $proxy_x_forwarded_proto { default $http_x_forwarded_proto; '' $scheme; } map $http_x_forwarded_port $proxy_x_forwarded_port { default $http_x_forwarded_port; '' $server_port; } map $http_upgrade $proxy_connection { default upgrade; '' close; } map $scheme $proxy_x_forwarded_ssl { default off; https on; } gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; log_format vhost '$host $remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"'; access_log off; # HTTP 1.1 support proxy_http_version 1.1; proxy_buffering off; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $proxy_connection; 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 $proxy_x_forwarded_proto; proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl; proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port; # Mitigate httpoxy attack (see README for details) proxy_set_header Proxy ""; server { server_name _; # This is just an invalid value which will never trigger on a real hostname. listen 80; access_log /var/log/nginx/access.log vhost; return 503; } # staging.mysite.com upstream staging.mysite.com { # staging_nginx server 172.18.0.3:80; } server { server_name staging.mysite.com; listen 80 ; access_log /var/log/nginx/access.log vhost; include /etc/nginx/vhost.d/staging.mysite.com; location / { proxy_pass http://staging.mysite.com; } } 

/etc/nginx/vhost.d/staging.mysite.com内容:

 location ~* ^/static/(.*) { try_files $uri @s3; } location @s3{ set $s3_bucket 's3-eu-west-1.amazonaws.com'; set $url_full '/mysite/staging/static/$1'; proxy_http_version 1.1; proxy_set_header Host $s3_bucket; proxy_set_header Authorization ''; proxy_hide_header x-amz-id-2; proxy_hide_header x-amz-request-id; proxy_hide_header Set-Cookie; proxy_ignore_headers "Set-Cookie"; proxy_buffering off; proxy_intercept_errors on; resolver 8.8.4.4 8.8.8.8 valid=300s; resolver_timeout 10s; proxy_pass https://$s3_bucket/$url_full; } 

我很难过 我没有看到任何错误。 通过S3url访问video时效果很好。 他们不是很大的video – 大约10-30 MB。 代理上的nginxconfiguration有什么问题,停止它提供video文件?