개발모음집

NGINX RTMP SOURCE INSTALL 본문

TheRestDevelop

NGINX RTMP SOURCE INSTALL

void 2018. 6. 28. 09:00
    1. Download, build and install

Build Utilities

    sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

Make and CD to build directory (home)

    sudo mkdir ~/build && cd ~/build

Download & unpack latest nginx-rtmp (you can also use http)

    sudo git clone git://github.com/arut/nginx-rtmp-module.git

Download & unpack nginx (you can also use svn)

    sudo wget http://nginx.org/download/nginx-1.12.0.tar.gz
    sudo tar xzf nginx-1.12.0.tar.gz
    cd nginx-1.12.0


apt-get update

apt-get install libpcre3 libpcre3-dev

apt-get install build-essential



출처: http://paphopu.tistory.com/20 [파포푸]

출처 : http://wifida.tistory.com/118


Build nginx with nginx-rtmp

    sudo ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module
    sudo make
    sudo make install

Start nginx Server

    sudo /usr/local/nginx/sbin/nginx
    1. Set up live streaming

To set up RTMP support you need to add `rtmp{}` section to `nginx.conf` (can be found in PREFIX/conf/nginx.conf). Stock `nginx.conf` contains only `http{}` section.

    sudo nano /usr/local/nginx/conf/nginx.conf

Use this `nginx.conf` instead of stock config:

    error_log  logs/error.log debug;
    
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        server {
            listen       8080;
            server_name  localhost;
            # sample handlers
            #location /on_play {
            #    if ($arg_pageUrl ~* localhost) {
            #        return 201;
            #    }
            #    return 202;
            #}
            #location /on_publish {
            #    return 201;
            #}
            #location /vod {
            #    alias /var/myvideos;
            #}
            # 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/build/nginx-rtmp-module;
            }
            # rtmp control
            location /control {
                rtmp_control all;
            }
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
    }
    rtmp {
        server {
            listen 1935;
            ping 30s;
            notify_method get;
            application myapp {
                live on;
                # sample play/publish handlers
                #on_play http://localhost:8080/on_play;
                #on_publish http://localhost:8080/on_publish;
                # sample recorder
                #recorder rec1 {
                #    record all;
                #    record_interval 30s;
                #    record_path /tmp;
                #    record_unique on;
                #}
                # sample HLS
                #hls on;
                #hls_path /tmp/hls;
                #hls_sync 100ms;
            }
            # Video on demand
            #application vod {
            #    play /var/Videos;
            #}
            # Video on demand over HTTP
            #application vod_http {
            #    play http://localhost:8080/vod/;
            #}
        }
    }

Restart nginx with:

    sudo /usr/local/nginx/sbin/nginx -s stop
    sudo /usr/local/nginx/sbin/nginx

$ sudo apt install ffmpeg

참고 :  github



$ sudo wget https://raw.githubusercontent.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx


$ sudo chmod +x /etc/init.d/nginx


# 자동으로 시작할 수 있게 등록해 줍니다.

$ sudo update-rc.d -f nginx defaults

참고 : 싸피티



에러 

1. ./configure command not found

configure를 찾지못하는 이유는 nginx 파일이 있는 곳에서 컴파일 해준게 아니라서 나는 에러

해결법 => cd nginx-1.12.0


2. configure: error: Cannot find ~. Please use ~

 "--" -- 이게 0 옆에 있는 -과  github에 적혀있는 - 이 다른듯

해결법 => github에 가서 configure 명령어를 ctrl + C 해서 붙여넣으면 해결



3. ./configure: error: C compiler cc is not found

해결법 => sudo apt-get install build-essential

참고 : paphopu


4. ./configure: error: the HTTP rewrite module requires the PCRE library.

해결법 => $ apt-get install libpcre3 libpcre3-dev

참고 : wifida


5. ./configure: error: SSL modules require the OpenSSL library.

해결법 => $ apt-get install libssl-dev openssl

참고 : wifida



https://github.com/nginx/nginx/blob/master/conf/nginx.conf


http://idchowto.com/?p=13416



mariadb



apt-get install mariadb-server mariadb-client
  257  export LANGUAGE=en_US.UTF-8
  258  export LC_ALL=en_US.UTF-8
  259  locale-gen en_US.UTF-8
  260  dpkg-reconfigure locales
  262  sudo systemctl start  mysql.service
  263  sudo systemctl status  mysql.service
  264  sudo mysql_secure_installation
  265  sudo systemctl restart mysql.service
  266  sudo mysql -u root -p


/etc/init.d/mysql start


php


  283  apt install php7.1 php7.1-fpm

  284  systemctl start php7.1-fpm

  285  systemctl status php7.1-fpm

  288  sudo /usr/local/nginx/sbin/nginx -s stop

  289  nano /usr/local/nginx/conf/nginx.conf


출처 : https://www.tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/


만약 php설치안되면

apt-add-repository ppa:ondrej/php

apt-get update