正在显示
1 个修改的文件
包含
62 行增加
和
66 行删除
| @@ -272,50 +272,48 @@ function write_nginx_html5() | @@ -272,50 +272,48 @@ function write_nginx_html5() | ||
| 272 | END | 272 | END |
| 273 | } | 273 | } |
| 274 | __SRS_BUILD_NGINX=NO; if [ $SRS_ARM_UBUNTU12 = NO ]; then if [ $SRS_HLS = YES ]; then __SRS_BUILD_NGINX=YES; fi fi | 274 | __SRS_BUILD_NGINX=NO; if [ $SRS_ARM_UBUNTU12 = NO ]; then if [ $SRS_HLS = YES ]; then __SRS_BUILD_NGINX=YES; fi fi |
| 275 | -if [ $SRS_ARM_UBUNTU12 = NO ]; then | ||
| 276 | - if [ $SRS_HLS = YES ]; then | ||
| 277 | - if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then | ||
| 278 | - echo "nginx-1.5.7 is ok."; | ||
| 279 | - else | ||
| 280 | - echo "build nginx-1.5.7"; | ||
| 281 | - ( | ||
| 282 | - rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && | ||
| 283 | - unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && | ||
| 284 | - ./configure --prefix=`pwd`/_release && make ${SRS_JOBS} && make install && | ||
| 285 | - cd .. && ln -sf nginx-1.5.7/_release nginx | ||
| 286 | - ) | ||
| 287 | - fi | ||
| 288 | - # check status | ||
| 289 | - ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi | ||
| 290 | - if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi | ||
| 291 | - | ||
| 292 | - # use current user to config nginx, | ||
| 293 | - # srs will write ts/m3u8 file use current user, | ||
| 294 | - # nginx default use nobody, so cannot read the ts/m3u8 created by srs. | ||
| 295 | - cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk | ||
| 296 | - sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf | ||
| 297 | - | ||
| 298 | - # create forward dir | ||
| 299 | - mkdir -p ${SRS_OBJS}/nginx/html/live && | ||
| 300 | - mkdir -p ${SRS_OBJS}/nginx/html/forward/live | ||
| 301 | - | ||
| 302 | - # generate default html pages for android. | ||
| 303 | - html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5 | ||
| 304 | - html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5 | ||
| 305 | - html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5 | ||
| 306 | - html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5 | ||
| 307 | - html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5 | ||
| 308 | - html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5 | ||
| 309 | - | ||
| 310 | - # copy players to nginx html dir. | ||
| 311 | - rm -rf ${SRS_OBJS}/nginx/html/players && | ||
| 312 | - ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players && | ||
| 313 | - rm -f ${SRS_OBJS}/nginx/crossdomain.xml && | ||
| 314 | - ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml | ||
| 315 | - | ||
| 316 | - # nginx.html to detect whether nginx is alive | ||
| 317 | - echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html | 275 | +if [ $__SRS_BUILD_NGINX = YES ]; then |
| 276 | + if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then | ||
| 277 | + echo "nginx-1.5.7 is ok."; | ||
| 278 | + else | ||
| 279 | + echo "build nginx-1.5.7"; | ||
| 280 | + ( | ||
| 281 | + rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && | ||
| 282 | + unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && | ||
| 283 | + ./configure --prefix=`pwd`/_release && make ${SRS_JOBS} && make install && | ||
| 284 | + cd .. && ln -sf nginx-1.5.7/_release nginx | ||
| 285 | + ) | ||
| 318 | fi | 286 | fi |
| 287 | + # check status | ||
| 288 | + ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi | ||
| 289 | + if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi | ||
| 290 | + | ||
| 291 | + # use current user to config nginx, | ||
| 292 | + # srs will write ts/m3u8 file use current user, | ||
| 293 | + # nginx default use nobody, so cannot read the ts/m3u8 created by srs. | ||
| 294 | + cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk | ||
| 295 | + sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf | ||
| 296 | + | ||
| 297 | + # create forward dir | ||
| 298 | + mkdir -p ${SRS_OBJS}/nginx/html/live && | ||
| 299 | + mkdir -p ${SRS_OBJS}/nginx/html/forward/live | ||
| 300 | + | ||
| 301 | + # generate default html pages for android. | ||
| 302 | + html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5 | ||
| 303 | + html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5 | ||
| 304 | + html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5 | ||
| 305 | + html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5 | ||
| 306 | + html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5 | ||
| 307 | + html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5 | ||
| 308 | + | ||
| 309 | + # copy players to nginx html dir. | ||
| 310 | + rm -rf ${SRS_OBJS}/nginx/html/players && | ||
| 311 | + ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players && | ||
| 312 | + rm -f ${SRS_OBJS}/nginx/crossdomain.xml && | ||
| 313 | + ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml | ||
| 314 | + | ||
| 315 | + # nginx.html to detect whether nginx is alive | ||
| 316 | + echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html | ||
| 319 | fi | 317 | fi |
| 320 | 318 | ||
| 321 | if [ $SRS_HLS = YES ]; then | 319 | if [ $SRS_HLS = YES ]; then |
| @@ -364,30 +362,28 @@ ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forwa | @@ -364,30 +362,28 @@ ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forwa | ||
| 364 | 362 | ||
| 365 | # only when the nginx is ok, | 363 | # only when the nginx is ok, |
| 366 | # if api-server not enalbed, use nginx as demo. | 364 | # if api-server not enalbed, use nginx as demo. |
| 367 | -if [ $SRS_ARM_UBUNTU12 = NO ]; then | ||
| 368 | - if [ $SRS_HLS = YES ]; then | ||
| 369 | - if [ $SRS_HTTP_CALLBACK = YES ]; then | ||
| 370 | - # override the default index. | ||
| 371 | - rm -f ${SRS_OBJS}/nginx/html/index.html && | ||
| 372 | - ln -sf `pwd`/research/players/nginx_index.html ${SRS_OBJS}/nginx/html/index.html | ||
| 373 | - else | ||
| 374 | - rm -f ${SRS_OBJS}/nginx/html/index.html && | ||
| 375 | - cat<<END >> ${SRS_OBJS}/nginx/html/index.html | ||
| 376 | - <!DOCTYPE html> | ||
| 377 | - <html> | ||
| 378 | - <head> | ||
| 379 | - <title>SRS</title> | ||
| 380 | - <meta charset="utf-8"> | ||
| 381 | - </head> | ||
| 382 | - <body> | ||
| 383 | - <script type="text/javascript"> | ||
| 384 | - setTimeout(function(){ | ||
| 385 | - window.location.href = "players/index.html" + window.location.search; | ||
| 386 | - }, 500); | ||
| 387 | - </script> | ||
| 388 | - </body> | 365 | +if [ $__SRS_BUILD_NGINX = YES ]; then |
| 366 | + if [ $SRS_HTTP_CALLBACK = YES ]; then | ||
| 367 | + # override the default index. | ||
| 368 | + rm -f ${SRS_OBJS}/nginx/html/index.html && | ||
| 369 | + ln -sf `pwd`/research/players/nginx_index.html ${SRS_OBJS}/nginx/html/index.html | ||
| 370 | + else | ||
| 371 | + rm -f ${SRS_OBJS}/nginx/html/index.html && | ||
| 372 | + cat<<END >> ${SRS_OBJS}/nginx/html/index.html | ||
| 373 | +<!DOCTYPE html> | ||
| 374 | +<html> | ||
| 375 | +<head> | ||
| 376 | + <title>SRS</title> | ||
| 377 | + <meta charset="utf-8"> | ||
| 378 | +</head> | ||
| 379 | +<body> | ||
| 380 | + <script type="text/javascript"> | ||
| 381 | + setTimeout(function(){ | ||
| 382 | + window.location.href = "players/index.html" + window.location.search; | ||
| 383 | + }, 500); | ||
| 384 | + </script> | ||
| 385 | +</body> | ||
| 389 | END | 386 | END |
| 390 | - fi | ||
| 391 | fi | 387 | fi |
| 392 | fi | 388 | fi |
| 393 | 389 |
-
请 注册 或 登录 后发表评论