diff --git a/README.md b/README.md index bffeb8d84..f9ec9c7f8 100755 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ step 2: start srs
step 3(optional): start nginx for HLS
-sudo ./objs/nginx/_release/sbin/nginx
+sudo ./objs/nginx/sbin/nginx
 
step 4: publish live stream
diff --git a/trunk/3rdparty/nginx-1.5.0.zip b/trunk/3rdparty/nginx-1.5.0.zip
new file mode 100644
index 000000000..09b1ef6e2
Binary files /dev/null and b/trunk/3rdparty/nginx-1.5.0.zip differ
diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf
index 8a4114691..c26ab4cd0 100755
--- a/trunk/conf/srs.conf
+++ b/trunk/conf/srs.conf
@@ -12,7 +12,7 @@ vhost __defaultVhost__ {
     enabled         on;
     gop_cache       on;
     hls             on;
-    hls_path        ./hls;
+    hls_path        ./objs/nginx/html;
 }
 # the vhost disabled.
 vhost removed.vhost.com {
@@ -28,8 +28,17 @@ vhost no-hls.vhost.com {
     # default: on
     hls             on;
     # the hls output path.
-    # default: ./hls
-    hls_path        /data/nginx/html/hls;
+    # the app dir is auto created under the hls_path.
+    # for example, for rtmp stream:
+    #   rtmp://127.0.0.1/live/livestream
+    #   http://127.0.0.1/live/livestream.m3u8
+    # where hls_path is /hls, srs will create the following files:
+    #   /hls/live       the app dir for all streams.
+    #   /hls/live/livestream.m3u8   the HLS m3u8 file.
+    #   /hls/live/livestream-1.ts   the HLS media/ts file.
+    # in a word, the hls_path is for vhost.
+    # default: ./objs/nginx/html
+    hls_path        /data/nginx/html;
 }
 # the vhost with hls disabled.
 vhost no-hls.vhost.com {
diff --git a/trunk/configure b/trunk/configure
index 38a349f60..6f1f309bf 100755
--- a/trunk/configure
+++ b/trunk/configure
@@ -46,6 +46,28 @@ ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret";
 if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
 if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
 
+# nginx for HLS, nginx-1.5.0
+if [[ -f ${GLOBAL_DIR_OBJS}/nginx-1.5.0/_release/sbin/nginx ]]; then
+    echo "nginx-1.5.0 is ok.";
+else
+    echo "build nginx-1.5.0"; 
+    (
+        rm -rf ${GLOBAL_DIR_OBJS}/nginx-1.5.0 && cd ${GLOBAL_DIR_OBJS} && 
+        unzip -q ../3rdparty/nginx-1.5.0.zip && cd nginx-1.5.0 && 
+        ./configure --prefix=`pwd`/_release && make && make install &&
+        ln -sf `pwd`/_release ../nginx
+    )
+fi
+# check status
+ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.0 failed, ret=$ret"; exit $ret; fi
+if [ ! -f ${GLOBAL_DIR_OBJS}/nginx-1.5.0/_release/sbin/nginx ]; then echo "build nginx-1.5.0 failed."; exit -1; fi
+
+# use current user to config nginx,
+# srs will write ts/m3u8 file use current user,
+# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
+cp ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf.bk
+sed -i "s/^.user  nobody;/user `whoami`;/g" ${GLOBAL_DIR_OBJS}/nginx/conf/nginx.conf
+
 #####################################################################################
 # generate Makefile.
 #####################################################################################
@@ -141,3 +163,5 @@ echo 'configure ok! '
 echo "you can:"
 echo "\" make \" to build the srs(simple rtmp server)."
 echo "\" make help \" to get the usage of make"
+echo "\" sudo ./objs/nginx/sbin/nginx  \" to start the nginx http server for hls"
+echo "\" ./objs/simple_rtmp_server -c conf/srs.conf \" to start the srs live server"
diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp
index 51382bc7d..c884c277b 100644
--- a/trunk/src/core/srs_core.hpp
+++ b/trunk/src/core/srs_core.hpp
@@ -63,7 +63,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 	(void)0
 
 // current release version
-#define RTMP_SIG_SRS_VERSION "0.4.0"
+#define RTMP_SIG_SRS_VERSION "0.5.0"
 // server info.
 #define RTMP_SIG_SRS_KEY "srs"
 #define RTMP_SIG_SRS_ROLE "origin server"
diff --git a/trunk/src/core/srs_core_config.hpp b/trunk/src/core/srs_core_config.hpp
index 5e3fae16d..32d7d910a 100644
--- a/trunk/src/core/srs_core_config.hpp
+++ b/trunk/src/core/srs_core_config.hpp
@@ -37,7 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // default vhost for rtmp
 #define RTMP_VHOST_DEFAULT "__defaultVhost__"
 
-#define SRS_CONF_DEFAULT_HLS_PATH "./hls"
+#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"
 
 class SrsFileBuffer
 {