使っているnginx.confの内容は次の通り。ファイルは\nginx\confフォルダにある。
#user nobody;
worker_processes 1;
error_log logs/error.log crit;
events {
worker_connections 1024;
}
http {
access_log off;
include mime.types;
types {
application/x-mpegURL m3u8;
video/MP2T ts;
}
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#server {
# listen 80;
# server_name localhost;
#
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 8888;
location / {
root live;
index index.html index.htm;
}
location /live/ {
rewrite ^/live/(.*) /$1 redirect;
}
# This URL provides RTMP statistics in XML
location /stat {
allow 127.0.0.1;
allow 192.168.0.0/16;
allow 172.16.0.0/12;
allow 10.0.0.0/8;
deny all;
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# you can move stat.xsl to a different location
root html;
}
# rtmp control
location /control {
allow 127.0.0.1;
allow 192.168.0.0/16;
allow 172.16.0.0/12;
allow 10.0.0.0/8;
deny all;
rtmp_control all;
}
}
}
rtmp {
server {
listen 1935;
access_log logs/rtmp_access.log;
ping 30s;
ping_timeout 10s;
#chunk_size 8192;
#max_streams 10;
drop_idle_publisher 15s;
application live {
live on;
wait_video on;
#wait_key on;
meta copy;
#idle_streams off;
#publish_notify on;
allow publish 127.0.0.1;
allow publish 192.168.0.0/16;
allow publish 172.16.0.0/12;
allow publish 10.0.0.0/8;
deny publish all;
hls on;
hls_path live/ts;
hls_continuous on;
hls_playlist_length 18s;
}
}
}
rtmp設定では
wait_video onが必須。最近のFlashの更新でこれがないと再生開始されない不具合が発生(IE環境では再現率100%)。また、配信エンコーダーからの接続はプライベートIPに限定している。
listen 80のserverブロックのコメントを解除すればWebサーバーとして利用可能。その際のホームディレクトリは\nginx\htmlフォルダになる。