CentOS 快速安裝 Nginx with RTMP module

之前裝在Ubuntu的那一篇 一樣
都是沒有設定stat的部分, 需要在另外修改

大致上跟Ubuntu的方式都相同
只是要注意的為 init script 可不可正常進行
測試的範例中是修改 nginx.conf 將 pid 那一行給取消註腳

pid        logs/nginx.pid;
#!/bin/sh
yum groupinstall 'Development Tools' -y
yum install pcre pcre-devel openssl-devel libxslt-devel -y
cd /tmp
wget http://nginx.org/download/nginx-1.7.3.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
tar -zxvf nginx-1.7.3.tar.gz
yum install unzip -y
unzip master.zip
cd nginx-1.7.3/
./configure --with-http_ssl_module --with-http_xslt_module --add-module=../nginx-rtmp-module-master
make
make install

cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak

echo " " >> /usr/local/nginx/conf/nginx.conf
echo "rtmp {" >> /usr/local/nginx/conf/nginx.conf
echo "        server {"  >> /usr/local/nginx/conf/nginx.conf
echo "                listen 1935;" >> /usr/local/nginx/conf/nginx.conf
echo "                chunk_size 4096;" >> /usr/local/nginx/conf/nginx.conf
echo " " >> /usr/local/nginx/conf/nginx.conf
echo "                application live {" >> /usr/local/nginx/conf/nginx.conf
echo "                        live on;" >> /usr/local/nginx/conf/nginx.conf
echo "                        record off;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #allow publish 127.0.0.1;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #deny publish all;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #allow play 127.0.0.1;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #deny play all;" >> /usr/local/nginx/conf/nginx.conf
echo "                }" >> /usr/local/nginx/conf/nginx.conf
echo "        }" >> /usr/local/nginx/conf/nginx.conf
echo "}" >> /usr/local/nginx/conf/nginx.conf

# 這邊直接使用放在網站上的檔案
# 請複製 http://wiki.nginx.org/RedHatNginxInitScript 中的檔案至 nignx 中
cd /etc/init.d/
vim nginx
chmod +x nginx
service nginx start
# service nginx start|stop|reload
This entry was posted in CentOS, Nginx, RTMP. Bookmark the permalink.