winlin

add http config in srs conf

1 # all config for srs 1 # all config for srs
2 2
3 -# the listen ports, split by space. 3 +#############################################################################################
  4 +# RTMP sections
  5 +#############################################################################################
  6 +# the rtmp listen ports, split by space.
4 listen 1935; 7 listen 1935;
5 # the pid file 8 # the pid file
6 # to ensure only one process can use a pid file 9 # to ensure only one process can use a pid file
@@ -33,12 +36,70 @@ max_connections 1000; @@ -33,12 +36,70 @@ max_connections 1000;
33 # whether start as deamon 36 # whether start as deamon
34 # default: on 37 # default: on
35 daemon on; 38 daemon on;
  39 +
  40 +#############################################################################################
  41 +# HTTP sections
  42 +#############################################################################################
  43 +# api of srs.
  44 +# the http api config, export for external program to manage srs.
  45 +# user can access http api of srs in browser directly, for instance, to access by:
  46 +# curl http://192.168.1.170:1985/api/v1/reload
  47 +# which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api,
  48 +# where the cli can only be used in shell/terminate.
  49 +http_api {
  50 + # whether http api is enabled.
  51 + # default: off
  52 + enabled on;
  53 + # the http api port
  54 + # default: 1985
  55 + listen 1985;
  56 +}
  57 +# embeded http server in srs.
  58 +# the http streaming config, for HLS/HDS/DASH/HTTPProgressive
  59 +# global config for http streaming, user must config the http section for each vhost.
  60 +# the embed http server used to substitute nginx in ./objs/nginx,
  61 +# for example, srs runing in arm, can provides RTMP and HTTP service, only with srs installed.
  62 +# user can access the http server pages, generally:
  63 +# curl http://192.168.1.170:80/srs.html
  64 +# which will show srs version and welcome to srs.
  65 +# @remeark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__
  66 +# need to open the feature http of vhost.
  67 +http_stream {
  68 + # whether http streaming service is enabled.
  69 + # default: off
  70 + enabled on;
  71 + # the http streaming port
  72 + # default: 80
  73 + listen 80;
  74 +}
  75 +
  76 +#############################################################################################
  77 +# RTMP/HTTP VHOST sections
  78 +#############################################################################################
36 # vhost list, the __defaultVhost__ is the default vhost 79 # vhost list, the __defaultVhost__ is the default vhost
37 # for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream. 80 # for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
38 # for which cannot identify the required vhost. 81 # for which cannot identify the required vhost.
39 vhost __defaultVhost__ { 82 vhost __defaultVhost__ {
40 enabled on; 83 enabled on;
41 gop_cache on; 84 gop_cache on;
  85 + http {
  86 + enabled on;
  87 + dir ./objs/nginx/html;
  88 + }
  89 +}
  90 +
  91 +# vhost for http
  92 +vhost http.srs.com {
  93 + # http vhost specified config
  94 + http {
  95 + # whether enable the http streaming service for vhost.
  96 + # default: off
  97 + enabled on;
  98 + # main dir of vhost,
  99 + # to delivery HTTP stream of this vhost.
  100 + # default: ./objs/nginx/html;
  101 + dir ./objs/nginx/html;
  102 + }
42 } 103 }
43 104
44 # vhost for atc. 105 # vhost for atc.