Ubuntu x64 快速安裝 Nginx with RTMP module

#!/bin/sh
apt-get install build-essential libpcre3 libpcre3-dev libssl-dev libxslt-dev -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 
apt-get 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 /tmp/nginx-rtmp-module-master/stat.xsl /usr/local/nginx/html/
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/Nginx-init-ubuntu 內容至 nginx 檔案中
cd /etc/init.d/
vim nginx
chmod +x nginx

service nginx start
# service nginx start|stop|reload
This entry was posted in Nginx, Ubuntu. Bookmark the permalink.