阅读背景:

Nginx + Rtmp 实现rtmp和HLS直播流,同时实现时移(分段录制回放)功能_ZJJ2310的博客

来源:互联网 
#!/bin/sh

if [ $(id -u) != "0" ]; then
    echo "Error: Please use root role to install!"
    exit 1
fi

clear
echo "========================================"
echo ""
echo "========================================"
echo "======= nginx_rtmp one key sctipt ======"
echo "========================================"
echo ""
echo "========================================"

get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
#echo "Press any key to start...or Press Ctrl+c to cancel"
#char=`get_char`

echo "========================================"
echo "Start install nginx_rtmp ..."
echo "========================================"
yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel

cur_dir=$(pwd)

cd nginx-1.8.0

echo "========================================"
echo "configure start ..."
echo "========================================"

 ./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--error-log-path=/usr/local/nginx/logs/error.log \
--add-module=../nginx-rtmp-module \
--with-http_mp4_module

echo "========================================"
echo "make &install"
echo "========================================"

make
make install

echo "========================================"
echo "Setting start"
echo "========================================"

cd $cur_dir
\cp nginx.conf /usr/local/nginx/
\cp nginx-rtmp-module/stat.xsl /usr/local/nginx/html/
\cp nginx /etc/rc.d/init.d/
chmod +x /etc/rc.d/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
service nginx start
echo "Service Test:"
echo "service nginx status"
echo "Result:"
service nginx status

#cat > /etc/fstab <<EOF
#tmpfs /usr/local/nginx/html/app tmpfs defaults,size=512M 0 0
#EOF
#mount -a
#echo "tmpfs Test:"
#df -h
mount -t tmpfs -o size=512m tmpfs /usr/local/nginx/html/app
echo "mount -t tmpfs -o size=512m tmpfs /usr/local/nginx/html/app" >> /etc/rc.d/rc.local


echo "========================================"
echo "Firewall config"
echo "========================================"

iptables -I INPUT -p tcp --dport 6080 -j ACCEPT
iptables -I INPUT -p tcp --dport 5080 -j ACCEPT
iptables -I INPUT -p tcp --dport 1935 -j ACCEPT
service iptables save

echo "========================================"
echo "Install end."
echo "========================================"
#!/bin/sh

if [ $(id -u) != "0" ]; the



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: