티스토리 뷰
출처
openssl 라이브러리 소스 다운로드
PCRE 라이브러리 설치
zip 라이브러리 설치
nginx 설치
nginx-vod-module 소스 다운로드
nginx 소스 다운로드
빌드 환경 설정 - configure
- --add-module=../nginx-vod-module : 스트리밍 관련 라이브러리 추가
- --pid-path : pid 파일 생성 기본 경로 / 해당 옵션이 없는 경우 nginx.conf에서 설정 가능
--add-module=../nginx-vod-module \
--prefix=/usr/local/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/usr/local/nginx/logs/error.log \
--http-log-path=/usr/local/nginx/logs/access.log \
--user=nginx \
--group=nginx \
--lock-path=/usr/local/nginx/system/nginx.lock \
--pid-path=/usr/local/nginx/system/nginx.pid \
--without-http_autoindex_module \
--without-http_ssi_module \
--with-file-aio \
--with-http_ssl_module \
--with-openssl=../openssl-1.1.1g \
--with-openssl-opt=enable-weak-ssl-ciphers \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-http_addition_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-threads --with-stream \
--with-stream_ssl_module \
--with-http_v2_module \
--http-client-body-temp-path=/var/cache/nginx/client_body_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
빌드
설치
make -f objs/Makefile install
make[1]: Entering directory '/home/pi/nginx-1.19.7'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
cp conf/fastcgi_params \
'/usr/local/nginx/conf/fastcgi_params.default'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
cp conf/uwsgi_params \
'/usr/local/nginx/conf/uwsgi_params.default'
cp conf/scgi_params \
'/usr/local/nginx/conf/scgi_params.default'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/system' \
|| mkdir -p '/usr/local/nginx/system'
test -d '/usr/local/nginx/logs' \
|| mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' \
|| cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' \
|| mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory '/home/pi/nginx-1.19.7'
nginx 계정 추가
error.log에 해당 오류 발견시 계정 추가 필요 nginx: [emerg] getpwnam("nginx") failed
nginx 서비스 등록
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=/usr/local/nginx/system/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
nginx.service 서비스 등록
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /etc/systemd/system/nginx.service.
nginx.service 서비스 시작
nginx.service 서비스 상태확인
nginx 스트리밍 관련 환경 설정
nginx.conf 수정
server { listen 80; server_name localhost; # vod settings vod_mode local; vod_fallback_upstream_location /fallback; vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT'; vod_last_modified_types *; vod_metadata_cache metadata_cache 512m; vod_response_cache response_cache 128m; gzip on; gzip_types application/vnd.apple.mpegurl; vod_segment_duration 1000; open_file_cache max=1000 inactive=5m; open_file_cache_valid 2m; open_file_cache_min_uses 1; open_file_cache_errors on; aio on; location /content/ { root /media_content/; vod hls; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range'; add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS'; add_header Access-Control-Allow-Origin '*'; expires 100d; }
nginx.service 서비스 재시작
동영상 파일 복사
동영상 구현 (hls.js)
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video" controls></video>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('http://192.168.0.87/content/big-buck-bunny-360p.mp4/index.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
// video.play();
});
}
</script>
확인

- Total
- Today
- Yesterday
- Delphi
- koba2010
- ubuntu
- 레이싱모델 익스트림 포토 페스티벌
- 서울오토살롱
- SAS
- ble
- Delphi Tip
- 전예희
- Mac
- sas2009
- ffmpeg
- Linux
- NDK
- MySQL
- android
- KOBA
- 지스타2007
- BPI-M4
- Java
- Xcode
- 튜닝쇼 2008
- 일본여행
- 동경
- flex
- 송주경
- JavaScript
- oracle
- Spring MVC
- Spring
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |