#!/bin/bash # # Install Standalone NGINX Server for Streaming RTMP HLS and DASH # (Does Not require root). # # This also downloads a custom premade nginx config file as well # as a website(html) for playback stream with ajax chat system. # # Author: Twily 2018-2019 # Website: twily.info # By default install into ~/nginx/* # Make sure DIR is correct! DIR=/home/user/nginx mkdir $DIR/src -p cd $DIR/src git clone https://github.com/arut/nginx-rtmp-module # More versions https://sourceforge.net/projects/pcre/files/pcre/ wget http://kent.dl.sourceforge.net/sourceforge/pcre/pcre-8.40.tar.gz tar -xzvf pcre-8.40.tar.gz # More versions http://nginx.org/en/download.html wget http://nginx.org/download/nginx-1.13.0.tar.gz tar -xzvf nginx-1.13.0.tar.gz cd nginx-1.13.0 ./configure --prefix=$DIR --with-http_ssl_module --with-file-aio --with-pcre=../pcre-8.40 --add-module=../nginx-rtmp-module make make install cd ../../ # Tools for controlling server echo -e "#!/bin/bash\n./sbin/nginx" > ./startng echo -e "#!/bin/bash\n./sbin/nginx -s stop" > ./stopng echo -e "#!/bin/bash\n./sbin/nginx -t && ./sbin/nginx -s reload" > ./reloadng chmod +x {./startng,./stopng,./reloadng} # Premade configuration file wget https://twily.info/nginxfiles/vjs/twily-stream-service.html -O ./twily-stream-service.html wget https://twily.info/nginxfiles/vjs/camonline.txt -O ./camonline.txt wget https://twily.info/nginxfiles/nginx.conf -O ./nginx.conf wget https://twily.info/nginxfiles/makethumb -O ./makethumb mv ./twily-stream-service.html ./html/twily-stream-service.html mv ./camonline.txt ./html/camonline.txt mv ./conf/nginx.conf ./conf/nginx.conf.bk mv ./nginx.conf ./conf/nginx.conf chmod +x ./makethumb ln -s ./html/twily-stream-service.html ./twily-stream-service.html ln -s ./conf/nginx.conf ./nginx.conf echo -e "\n>NGINX has been installed to \"$DIR\".\n" exit