#!/bin/bash yum update -y yum install -y wget git zlib-devel pcre-devel openssl-devel yum groupinstall -y "Development Tools" wget http://nginx.org/download/nginx-1.15.12.tar.gz tar xzf nginx-1.15.12.tar.gz git clone https://github.com/arut/nginx-rtmp-module.git cd nginx-1.15.12 ./configure --with-http_ssl_module --with-http_realip_module --add-module=../nginx-rtmp-module make make install useradd --shell=/sbin/nologin www-data mkdir /var/log/nginx cat < /lib/systemd/system/nginx.service [Unit] Description=The NGINX HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/usr/sbin/nginx -s reload ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target EOF ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old cat< /usr/local/nginx/conf/tmp error_log /var/log/nginx/error.log; pid /run/nginx.pid; EOF cat /usr/local/nginx/conf/tmp /usr/local/nginx/conf/nginx.conf.old > /usr/local/nginx/conf/nginx.conf rm -f /usr/local/nginx/conf/tmp rm -f /usr/local/nginx/conf/nginx.conf.old # https://www.nginx.com/resources/wiki/start/topics/examples/systemd/ # rtmp { # server { # listen 1935; # chunk_size 4096; # allow play all; # # access_log /var/log/nginx/rtmp.access.log combined # # application live { # live on; # hls on; # record off; # hls_path /usr/local/nginx/html/hlsdata # hls_fragment 3s; # hls_type live; # allow publish 192.0.2.1; # deny publish all; # } # } # }