hiro1357

nginx-rtmp-module install

Oct 19th, 2019
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.82 KB | None | 0 0
  1. #!/bin/bash
  2. yum update -y
  3. yum install -y wget git zlib-devel pcre-devel openssl-devel
  4. yum groupinstall -y "Development Tools"
  5. wget http://nginx.org/download/nginx-1.15.12.tar.gz
  6. tar xzf nginx-1.15.12.tar.gz
  7. git clone https://github.com/arut/nginx-rtmp-module.git
  8. cd nginx-1.15.12
  9. ./configure --with-http_ssl_module --with-http_realip_module --add-module=../nginx-rtmp-module
  10. make
  11. make install
  12. useradd --shell=/sbin/nologin www-data
  13. mkdir /var/log/nginx
  14.  
  15. cat <<EOF > /lib/systemd/system/nginx.service
  16. [Unit]
  17. Description=The NGINX HTTP and reverse proxy server
  18. After=syslog.target network.target remote-fs.target nss-lookup.target
  19.  
  20. [Service]
  21. Type=forking
  22. PIDFile=/run/nginx.pid
  23. ExecStartPre=/usr/sbin/nginx -t
  24. ExecStart=/usr/sbin/nginx
  25. ExecReload=/usr/sbin/nginx -s reload
  26. ExecStop=/bin/kill -s QUIT $MAINPID
  27. PrivateTmp=true
  28.  
  29. [Install]
  30. WantedBy=multi-user.target
  31. EOF
  32.  
  33. ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
  34.  
  35. mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old
  36. cat<<EOF > /usr/local/nginx/conf/tmp
  37. error_log  /var/log/nginx/error.log;
  38. pid        /run/nginx.pid;
  39. EOF
  40. cat /usr/local/nginx/conf/tmp /usr/local/nginx/conf/nginx.conf.old > /usr/local/nginx/conf/nginx.conf
  41. rm -f /usr/local/nginx/conf/tmp
  42. rm -f /usr/local/nginx/conf/nginx.conf.old
  43.  
  44. # https://www.nginx.com/resources/wiki/start/topics/examples/systemd/
  45.  
  46.  
  47. # rtmp {
  48. #    server {
  49. #       listen 1935;
  50. #       chunk_size 4096;
  51. #       allow play all;
  52. #
  53. #       access_log  /var/log/nginx/rtmp.access.log combined
  54. #
  55. #       application live {
  56. #           live on;
  57. #           hls on;
  58. #           record off;
  59. #           hls_path /usr/local/nginx/html/hlsdata
  60. #           hls_fragment 3s;
  61. #           hls_type live;
  62. #           allow publish 192.0.2.1;
  63. #           deny publish all;
  64. #       }      
  65. #    }
  66. # }
Add Comment
Please, Sign In to add comment