nginx 와 nginx - rtmp 를 사용 하여 스 트림 미디어 서버 를 구축 합 니 다.

4404 단어
실험 환경:root@bjphp2:/usr/local/nginx/conf# cat /etc/issue
Ubuntu 14.04.5 LTS \l
실험 목적: nginx 1.9.9 버 전 을 설치 하고 설정 파일 을 수정 하여 기 존 버 전의 nginx 를 대체 하 며 nginx - rmtp 모듈 을 추가 하여 스 트림 미디어 서버 를 구축 합 니 다.
설치 절차: 여 기 는 / usr / local 디 렉 터 리 에서 설치 하기 로 했 습 니 다.
root@bjphp2:/usr/local/nginx/conf# cd /usr/local/ 
다운로드 의존 -- pcre 라 이브 러 리 (perl 호 환 정규 표현 식)
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar zxvf pcre-8.40.tar.gz
zlib 라 이브 러 리 를 다운로드 하여 설치 합 니 다. (zlib 는 일반적인 압축 라 이브 러 리 입 니 다. in - memory 압축 과 압축 해제 함 수 를 제공 하고 압축 해 제 된 데이터 의 완전 성 (integrity) 을 검사 할 수 있 습 니 다. zlib 도 gzip (. gz) 형식의 파일 을 읽 고 쓰 는 것 을 지원 합 니 다.)
wget http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz
tar zxvf zlib-1.2.8.tar.gz
nginx 1.9.9 버 전 다운로드
wget http://nginx.org/download/nginx-1.9.9.tar.gz
tar zxvf nginx-1.9.9.tar.gz
nginx - rtmp 모듈 다운로드
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip
nginx 1.9.9 디 렉 터 리 에 들 어가 서 nginx 를 컴 파일 하여 설치 합 니 다.
root@bjphp2:/usr/local/nginx/conf# cd nginx-1.9.9/
./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_dav_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.8 --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --add-module=../nginx-rtmp-module-master
make
make install
주: 각 설정 매개 변수 에 대한 설명
-- prefix = / usr / local / nginx \ # nginx 설치 디 렉 터 리 를 설정 합 니 다. 기본 위 치 는 / usr / local / nginx 입 니 다.
-- pid - path = / var / run / nginx. pid \ # pid 파일 위 치 를 설정 합 니 다. 기본적으로 logs 디 렉 터 리 에 있 습 니 다.
-- lock - path = / var / lock / ngix. lock \ # lock 파일 위 치 를 설정 합 니 다. logs 디 렉 터 리 에 아무 도 없습니다.
--with-http_ssl_module \ # http ssl 모듈 을 열 어 https 요청 을 지원 합 니 다.
--with-http_dav_module \ # WebDAV 확장 동작 모듈 을 열 면 파일 과 디 렉 터 리 에 권한 을 지정 할 수 있 습 니 다.
--with-http_flv_module \ # flv 파일 드래그 재생 지원
--with-http_realip_module \ # 실제 소스 를 표시 하 는 ip 주 소 를 지원 합 니 다.
--with-http_gzip_static_module \ # 압축 파일 이 중복 되 지 않도록 미리 압축 하기 전에 검 사 를 합 니 다.
--with-http_stub_status_module \ # nginx 실행 상태 가 져 오기
-- with - mail \ # pop 3 / imap 4 / smtp 프 록 시 모듈 허용
--with-mail_ssl_module \ # pop 3 / imap 4 / smtp ssl / tles 사용 허용
-- with - pcre =.. / pcre - 8.37 \ # 여 기 는 설치 되 지 않 은 pcre 라 이브 러 리 경로, 즉 방금 압축 을 풀 었 던 경로 입 니 다.
-- with - zlib =.. / zlib - 1.2.8 \ # 여 기 는 설치 되 지 않 은 zlib 라 이브 러 리 경로, 즉 방금 압축 을 풀 었 던 경로 입 니 다. 
-- with - debug \ # 디버그 로그 열기
-- http - client - body - temp - path = / var / tmp / nginx / client \ # 클 라 이언 트 요청 임시 위치
-- http - proxy - temp - path = / var / tmp / nginx / proxy \ # http proxy 임시 파일 경로 설정
-- http - fastcgi - temp - path = / var / tmp / nginx / fastcgi \ # http fastcgi 임시 파일 경로 설정
-- http - uwsgi - temp - path = / var / tmp / nginx / uwsgi \ # uwsgi 임시 파일 경로 설정
-- http - scgi - temp - path = / var / tmp / nginx / scgi \ # scgi 임시 파일 경로 설정 
-- add - module =.. / nginx - rtmp - module - master \ # nginx - rtmp 모듈 을 설치 하고 경 로 는 방금 압축 을 풀 었 던 위치 입 니 다.
nginx 의 프로필 nginx. conf 를 수정 하고 파일 끝 에 rtmp 프로 토 콜 에 대한 설정 을 추가 합 니 다.
root@bjphp2:/usr/local/nginx/conf# cd /usr/local/nginx/conf/
root@bjphp2:/usr/local/nginx/conf# cp nginx.conf nginx.conf.bak   //백업 하 다
root@bjphp2:/usr/local/nginx/conf# vim /usr/local/nginx/conf/nginx.conf
파일 끝 에 다음 과 같이 추가
rtmp {     listen 1935;     chunk_size 4096;     application live {         live on;         record off;     } }
주: 파일 의 루트 위치 에 두 고 쓰 지 않도록 주의 하 세 요.  http  괄호 안에
이전 버 전의 nginx 프로필 과 비교 하여 nginx 1.9.9 프로필 을 수정 합 니 다.
회사 마다 nginx 프로필 이 다 릅 니 다. 자세 한 내용 은 쓰 지 않 고 상황 에 따라 정 합 니 다. 주로 프로필 nginx. conf, default 등 을 중심 으로 합 니 다.
신 구 nginx 교체 주의 포트 문제, 포트 번 호 를 변경 하거나 한 버 전 만 실행 해도 됩 니 다.
참고:http://crafteverywhere.github.io/2015/12/29/%E4%BD%BF%E7%94%A8nginx%E5%92%8Cnginx-rtmp%E6%90%AD%E5%BB%BA%E6%B5%81%E5%AA%92%E4%BD%93%E6%9C%8D%E5%8A%A1%E5%99%A8/

좋은 웹페이지 즐겨찾기