Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- apt-get install libpcre3-dev autoconf2.13 libssl-dev libcurl4-gnutls-dev libjpeg62-dev libpng12-dev libmysql++-dev libfreetype6-dev libt1-dev libc-client-dev libevent-dev libxml2-dev libtool libmcrypt-dev make libgeoip-dev psmisc unzip
- adduser --system --no-create-home --disabled-login --disabled-password --group www
- mkdir /var/lib/nginx
- mkdir -p /var/www/default/public_html
- chown www:www -R /var/www/default/public_html
- cd /usr/src/
- wget http://nginx.org/download/nginx-1.7.6.tar.gz
- tar -xzf nginx-1.7.6.tar.gz
- cd /usr/src/
- wget https://github.com/arut/nginx-rtmp-module/archive/master.zip -O master.zip
- unzip master.zip
- cd /usr/src/nginx-1.*
- ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=www --group=www --with-poll_module --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --http-scgi-temp-path=/var/lib/nginx/scgi --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-pcre --with-md5-asm --with-sha1-asm --with-zlib-asm=pentium --add-module=/usr/src/nginx-rtmp-module-master
- make && make install
- nano /etc/init.d/nginx
- -----
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: nginx
- # Required-Start: $all
- # Required-Stop: $all
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: starts the nginx web server
- # Description: starts nginx using start-stop-daemon
- ### END INIT INFO
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- DAEMON=/usr/sbin/nginx
- NAME=nginx
- DESC=nginx
- test -x $DAEMON || exit 0
- # Include nginx defaults if available
- if [ -f /etc/default/nginx ] ; then
- . /etc/default/nginx
- fi
- set -e
- . /lib/lsb/init-functions
- case "$1" in
- start)
- echo -n "Starting $DESC: "
- start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON -- $DAEMON_OPTS || true
- echo "$NAME."
- ;;
- stop)
- echo -n "Stopping $DESC: "
- start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON || true
- echo "$NAME."
- ;;
- restart|force-reload)
- echo -n "Restarting $DESC: "
- start-stop-daemon --stop --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON || true
- sleep 1
- start-stop-daemon --start --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
- echo "$NAME."
- ;;
- reload)
- echo -n "Reloading $DESC configuration: "
- start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON || true
- echo "$NAME."
- ;;
- status)
- status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
- ;;
- *)
- N=/etc/init.d/$NAME
- echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
- exit 1
- ;;
- esac
- exit 0
- -----
- chmod 755 /etc/init.d/nginx
- update-rc.d -f nginx defaults
- cd /usr/src
- mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.back
- nano /etc/nginx/nginx.conf
- -----
- user www;
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- sendfile on;
- keepalive_timeout 65;
- gzip on;
- server {
- listen 8080;
- server_name localhost;
- location / {
- root /var/www/default/public_html/;
- }
- # rtmp stat
- location /stat {
- rtmp_stat all;
- rtmp_stat_stylesheet stat.xsl;
- }
- location /stat.xsl {
- # you can move stat.xsl to a different location
- root /usr/src/nginx-rtmp-module-master;
- }
- # rtmp control
- location /control {
- rtmp_control all;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- location /hls {
- types {
- application/vnd.apple.mpegurl m3u8;
- }
- alias /run/shm;
- }
- }
- }
- rtmp {
- server {
- listen 1935;
- ping 30s;
- notify_method get;
- # Live
- application live {
- live on;
- hls on;
- hls_path /run/shm;
- hls_fragment 10s;
- hls_continuous on;
- hls_nested on;
- hls_fragment_naming sequential;
- hls_fragment_slicing aligned;
- }
- }
- }
- -----
- service nginx restart
- to access
- http://<ip>:8080/hls/<streamname>.m3u8
Advertisement
Add Comment
Please, Sign In to add comment