Report this

What is the reason for this report?

Setup nginx to video streaming

Posted on May 7, 2014

I use nginx to stream video from server.

But i get error: net::ERR_CONTENT_LENGTH_MISMATCH in this case:

  1. load page (video tag in background download small part of video - 2-3 Mb)
  2. wait one-two minutes
  3. play video browser download some more content (about 3 Mb) and then raise an error if i do not wait video play without errors

how can i fix this error?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

instal Nginx

Hi Ivan, <br> <br>If you could provide a little more information, we could probably help you better. Is this just static html with a video tag or are you using some kind dynamic framework? Also could you check the contents of your Nginx error log, most likely located at: <br> <br><pre> <br>/var/log/nginx/error.log <br></pre> <br> <br>I think that will probably show the real problem. Chances are it is a permissions issue. Is the video file accessible to the user running Nginx?

Additional information: <br>nginx vhost config: <br>server { <br> listen 80; <br> server_name media-server.com; <br> root /var/www/site; <br> index off; <br> access_log /var/log/nginx/media.access.log; <br> error_log /var/log/nginx/media.error.log; <br> <br> fastcgi_hide_header Set-Cookie; <br> expires max; <br> add_header Cache-Control public; <br> <br> location /video/ { <br> mp4; <br> root /var/www/site; <br> } <br>} <br> <br>error log files clean, no errors <br> <br>in access log, only successful requests: <br>ip - - [08/May/2014:18:04:58 +0300] “GET /video/shifts/8-9.mp4 HTTP/1.1” 304 0 “http://media-server.com/” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36” <br>ip - - [08/May/2014:18:05:58 +0300] “GET /video/more/cleverclover.mp4 HTTP/1.1” 206 822075 “http://media-server.com/” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36” <br> <br> <br>i get errors only in google chrome and opera browsers, in ff, safari, ie - video working good. <br> <br>i try use amazon s3, videos from amazon servers works fine, no errors. i compare headers from server - headers from my server same as amazon servers. <br> <br>i try this options: <br>1. disable gzip <br>2. set <br> keepalive_timeout 1200s; <br>3. set <br> proxy_http_version 1.1; <br> proxy_set_header Connection “”; <br> <br>but it makes no difference

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.