Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Setting up nginx for streaming with SSL

$
0
0
Hi,

I figure this is supposed to be a basic simple task, but there are a lot of things that just do not make sense, and I've tested with Apache and Lighttpd to ascertain the problem lies with nginx. All I am trying to do is setup an extremely basic nginx streaming server with SSL/TLS support. Not looking for RTMP or anything advanced, just something that works. My idea was simple, install nginx with mp4 enabled, put mp4s in a folder, and voila, everything should work, but it isn't. If I go without SSL/TLS, most of the issues go, most of the time, but majority of the time, I cannot stream the videos using an application like VLC, but, I can download the file, which is not my preferred way of doing things.

This is my nginx config.

# HTTPS server
#
server {
listen 443 ssl;
server_name localhost 127.0.0.1;
access_log /var/log/nginx/access_s.log;
error_log /var/log/nginx/error_s.log;

ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;

ssl_session_cache shared:SSL:5m;
ssl_verify_client off;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

location / {

root /path/to/videos ;
# index index.html index.htm;
mp4;
limit_rate_after 100m;
limit_rate 5m;
mp4_buffer_size 4M;
mp4_max_buffer_size 10M;
autoindex on;
allow all;
keepalive_timeout 65;
keepalive_requests 200;
reset_timedout_connection on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
gzip off;
expires 30d;
add_header Cache-Control public;
}
}
}

Problem 1: Files don't always play. Some play, some don't and I can't find a pattern to point to a specific problem. I have tried avis, movs, mkvs, flvs and some play and some don't. I have checked permissions, but that isn't it.

Problem 2: There is a weird problem with how nginx is presenting files and folders that doesn't seem to make sense. In the error log, I get an error like this

2014/06/29 16:01:49 [error] 2060#0: *580 open() "/path/to/files/series_a/series_aS02" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /path/to/files/series_a/series_aS02 HTTP/1.1", host: "127.0.0.1"

The player I am using is configured to recognise the folders as /path/to/files/series_a/S02 and when tested with Apache, or Lighty, it recognizes this without any issues. This problem is persistent with SSL and without and I have recompiled twice and pulled from repo to make sure the fault is not on my end, and it isn't.

Anyone know how to fix this?

Thanks.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>