CentOS6下基于Nginx搭建mp4/flv流媒体服务器(3)

# video on demand
            application vod {
                play /mnt/media/vod;
            }

# HLS
            # HLS requires libavformat & should be configured as a separate
            # NGINX module in addition to nginx-rtmp-module:
            # ./configure … –add-module=/path/to/nginx-rtmp-module/hls …
            # For HLS to work please create a directory in tmpfs (/tmp/app here)
            # for the fragments. The directory contents is served via HTTP (see
            # http{} section in config)
            #
            # Incoming stream must be in H264/AAC/MP3. For iPhones use baseline H264
            # profile (see ffmpeg example).
            # This example creates RTMP stream from movie ready for HLS:
            #
            # ffmpeg -loglevel verbose -re -i movie.avi  -vcodec libx264
            #    -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
            #    -f flv rtmp://localhost:1935/hls/movie
            #
            # If you need to transcode live stream use ‘exec’ feature.
            #
            application hls {
                hls on;
                hls_path /mnt/media/app;
                hls_fragment 10s;
            }
        }
    }

http {

include mime.types;
        default_type application/octet-stream;
        sendfile on;
        keepalive_timeout 65;
        gzip on;
       
          #log format

log_format  access  ‘$remote_addr – $remote_user [$time_local] “$request” ‘
                ‘$status $body_bytes_sent “$http_referer” ‘
                ‘”$http_user_agent” $http_x_forwarded_for’;   
       
          #定义一个名为addr的limit_zone,大小10M内存来存储session
        limit_conn_zone $binary_remote_addr zone=addr:10m;   

server {
            listen 8080;
              server_name localhost;

# HTTP can be used for accessing RTMP stats
            # This URL provides RTMP statistics in XML
            location /stat {
                rtmp_stat all;
                rtmp_stat_stylesheet stat.xsl;
            }
            location /stat.xsl {
                root /mnt/soft/nginx-rtmp-module-master;
            }
              location /control {
                rtmp_control all;
            }
            location / {
                root /mnt/soft/nginx-rtmp-module-master/test/rtmp-publisher;
            }
        }
       
          server {
            listen 80;
              server_name localhost;
             
            location / {
                    root /mnt/wwwroot;
                    index index.html;
                  }       

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/797407da1acb1a3248d2e79359e6021d.html