nginx点播和直播配置
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4000;
# video on demand
application vod {
play /video;
}
# 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;
live on;
hls_path /video/live;
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 /video/config/nginx-rtmp-module-master;
}
location /control {
rtmp_control all;
}
location / {
root /video/config/nginx-rtmp-module-master/rtmp-publisher;
}
}
server {
listen 80;
server_name player.hfyefan.cn;
location / {
root /video/wwwroot;
index index.html;
}
location ~ \.flv$ {
root /video;
flv;
limit_conn addr 20;
limit_rate 200k;
}
location ~ \.mp4$ {
root /video;
mp4;
limit_conn addr 20;
limit_rate 200k;
}
location /hls {
#Serve HLS fragments
alias /video/live;
}
access_log logs/nginxflv_access.log access;
}
}
相关阅读推荐
-
“直播+电商”的三种主要模式
直播为传统电商提供了一个全新的商品“社交”营销模式——主播将有相同爱好的观众聚集在直播间中,观众在电商直播平台上观看主播播出的内容时,就可以通过点击直播间上显示的链接直接购买产品。
-
金狗旺旺苹果APP如何添加信任软件(教程)
金狗旺旺苹果APP如何添加信任软件(教程)
-
合肥开发一个租房APP大概需要多少钱
合肥开发一个租房APP大概需要多少钱?合肥租房APP开发哪家网络公司比较靠谱。一个成熟的租房APP需要哪些基本功能?
最新资讯
资讯推荐阅读
-
“直播+电商”的三种主要模式
直播为传统电商提供了一个全新的商品“社交”营销模式——主播将有相同爱好的观众聚集在直播间中,观众在电商直播平台上观看主播播出的内容时,就可以通过点击直播间上显示的链接直接购买产品。
-
金狗旺旺苹果APP如何添加信任软件(教程)
金狗旺旺苹果APP如何添加信任软件(教程)
-
合肥开发一个租房APP大概需要多少钱
合肥开发一个租房APP大概需要多少钱?合肥租房APP开发哪家网络公司比较靠谱。一个成熟的租房APP需要哪些基本功能?
-
合肥开发个APP需要多少钱
合肥开发个APP需要多少钱
-
ubuntu14.04+nginx+rtmp搭建直播和点播流媒体服务器
ubuntu14.04+nginx+rtmp搭建直播和点播流媒体服务器
-
合肥开发个移动办公APP大概需要多少钱?合肥开发移动APP哪家网络公司比较靠谱?
合肥开发个移动办公APP大概需要多少钱?合肥开发移动APP哪家网络公司比较靠谱?移动办公APP大概需要哪些基本功能?