[메모] [회전] 설 치 된 Nginx 에 새 모듈 nginx - rtmp - module 추가

첫째, 먼저 nginx - rtmp - module 를 다운로드 합 니 다.
공식 github 주소:https://github.com/arut/nginx-rtmp-module 저 는 git 에서 git clone 을 직접 복 제 했 습 니 다.https://github.com/arut/nginx-rtmp-module.git git 오류 가 발생 하면 git 를 설치 할 때 루트 디 렉 터 리 에 nginx - rtmp - module 폴 더 가 있 을 것 입 니 다.
설치: nginx
nginx 의 공식 사 이 트 는:http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.12.1.tar.gz  
    tar -zxvf nginx-1.12.1.tar.gz  
    cd nginx-1.12.1  
    ./configure --prefix=/usr/local/nginx  --add-module=/nginx-rtmp-module    --with-http_ssl_module    
    make && make install  

nginx 를 설치 했다 면 제3자 모듈 을 따로 설치 해 야 합 니 다. nginx 제3자 모듈 설치 방법 을 다시 설치 할 수 없습니다.
./configure --prefix=/        --add-module=/       

nginx - rtmp - module 모듈 을 설치 하 는 것 을 예 로 들 면, nginx 가 설 치 된 상황 에서 nginx - rtmp - module 모듈 을 설치 합 니 다. 이전에 nginx 가 / usr / local / nginx 디 렉 터 리 에 설치 되 어 있 었 기 때문에, 아래 의 작업 은 모두 이 디 렉 터 리 를 경로 로 합 니 다. 다른 디 렉 터 리 에 설치 되면 대응 하 는 변경 명령 이 필요 합 니 다.먼저 기 존의 nginx 설정 파 라 메 터 를 보고 복사 (중요) 주의 V 는 대문자 입 니 다.
/usr/local/nginx/sbin/nginx -V
root@iZ1175b20bpZ:~# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.1
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
built with OpenSSL 1.0.2l  25 May 2017
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-openssl=/usr/local/nginx/src/openssl --add-module=/usr/local/nginx/src/ngx_devel_kit --add-module=/usr/local/nginx/src/lua_nginx_module --add-module=/usr/local/nginx/src/ngx_cache_purge --add-module=/usr/local/nginx/src/nginx-sticky-module --add-module=/usr/local/nginx/src/nginx-http-concat --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc

시스템 은 우리 가 이전에 설치 한 Nginx 설정 을 모두 열 거 했 습 니 다. 우 리 는 이전에 nginx - rtmp - module 모듈 을 설치 한 적 이 없 는 것 을 보 았 습 니 다.우 리 는 이번에 단독으로 설치 했다.위 에 저희 가 설치 한 nginx 버 전 은 1.12.1 이 라 고 나 와 있 습 니 다.   저 희 는 대응 버 전 을 사용 해 야 돼 요.  nginx 의 설치 패키지.
wget http://nginx.org/download/nginx-1.12.1.tar.gz 
tar -zxvf nginx-1.12.1.tar.gz 
cd nginx-1.12.1

다운로드 완료 및 압축 해제 후  들어가다  nginx - 1.12.1 디 렉 터 리 다음은 중요 한 단계 입 니 다. 위 에 설 치 된 nginx 설정 매개 변수 에 새로운 모듈 을 추가 합 니 다.
./configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-openssl=/usr/local/nginx/src/openssl --add-module=/usr/local/nginx/src/ngx_devel_kit --add-module=/usr/local/nginx/src/lua_nginx_module --add-module=/nginx-rtmp-module --add-module=/usr/local/nginx/src/ngx_cache_purge --add-module=/usr/local/nginx/src/nginx-sticky-module --add-module=/usr/local/nginx/src/nginx-http-concat --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc

주의 하 세 요. 안에 제 가 인 자 를 하나 더 넣 었 습 니 다.   --add-module=/nginx-rtmp-module   만약 당신 이 다른 모듈 을 함께 설치 해 야 한다 면 방법 은 같 습 니 다.설정 이 끝 날 때 까지 기 다 립 니 다.그리고 입력
make
컴 파일 을 진행 하 다.컴 파일 이 끝 난 후, 우 리 는 루트 디 렉 터 리 에서 우리 가 방금 다운로드 한 / nginx - 1.12.1 / objs / 디 렉 터 리 에서 해 야 합 니 다.방금 컴 파일 된 nginx 파일 을 찾 았 습 니 다 (확장자 가 없습니다)
nginx 파일 을 이전에 설 치 된 / usr / local / nginx / sbin / 디 렉 터 리 로 복사 하여 오래된 nginx 파일 을 교체 합 니 다.오래된 nginx 파일 을 백업 하 는 것 을 권장 합 니 다.그리고 nginx 를 다시 시작 하면 됩 니 다.
이 럴 때 우 리 는 다음 nginx 설정 을 보고 있 습 니 다.
root@iZ1175b20bpZ:~# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.1
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
built with OpenSSL 1.0.2l  25 May 2017
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-openssl=/usr/local/nginx/src/openssl --add-module=/usr/local/nginx/src/ngx_devel_kit --add-module=/usr/local/nginx/src/lua_nginx_module --add-module=/nginx-rtmp-module --add-module=/usr/local/nginx/src/ngx_cache_purge --add-module=/usr/local/nginx/src/nginx-sticky-module --add-module=/usr/local/nginx/src/nginx-http-concat --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc

우 리 는 nginx - rtmp - module 모듈 이 이미 있 는 것 을 보 았 다.다음 nginx. conf 파일 을 변경 하여 지원 합 니 다.  rtmp
3. nginx 프로필 수정
vi /usr/local/nginx/conf/nginx.conf  

파일 에 아래 내용 http 세그먼트 밖 을 추가 합 니 다 (맨 뒤에 불 러 오 면 됩 니 다. 독립 모듈)
rtmp {    
    
    server {    
    
        listen 1935;  #       
    
        chunk_size 4000;    
             
        application hls {  #rtmp        
            live on;    
            hls on;    
            hls_path /usr/local/nginx/html/hls;    
            hls_fragment 5s;    
        }    
    }    
}
        ,                ,   /usr/local/nginx/html/    ,
  /usr/local/nginx/html/hls        ,              hls,              

그리고 nginx 를 시작 합 니 다:
/usr/local/nginx/sbin/nginx

다음으로 이동:http://auan.cn/server/1716.html

좋은 웹페이지 즐겨찾기