반응형
nginx-rtmp 는 설치 완료됐다고 가정
에러 : nginx 유저가 없음
에러메세지 : nginx: [emerg] getpwnam("nginx") failed in /usr/local/nginx/conf/nginx.conf:1
해결 : sudo useradd -s /bin/bash -m nginx
rtmp 모듈의 기능 중 on publish , on done 으로 사용자 인증 & 썸네일 생성 트리거 활용을 위한 nodejs 서버 환경설정
node js 설치 경로 /usr/local/nginx
//순서대로 명령어를 치시오
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
source ~/.bashrc
nvm install 17.9.0
apt install npm
//익스프레스 프레임워크 설치
npm install --save express
// 다 기본설정으로 하기 때문에 계속 엔터 후 yes
npm init
//필요 모듈들 설치 경로 ==> /usr/local/nginx
npm install require
npm install mysql
npm install http
npm install request
//썸네일 생성 library는 global하게
npm install -g hls-live-thumbnails
//nodejs 데몬 관리 툴인 pm2 global하게 설치
npm install -g pm2
pm2로 데몬을 관리하기 위해 환경설정 파일 생성 --> /usr/local/nginx 경로
파일 이름 : ecosystem.config.js
module.exports = {
apps: [{
name : 'live',
script: 'index.js',
instances: 1,
exec_mode: `cluster`
},
{
name : 'thumbnail',
script: 'hls-live-thumbnails --ignorePlaylist404 --playlistRetryCount -1 --port 8001 --interval 200 --width 300 --neverDelete',
instances : 1,
exec_mode: `fork`
}]
}
파일을 만들었으면 pm2로 데몬 실행
pm2 start ecosystem.config.js
//pm2 list 확인
pm2 list
반응형
'Server' 카테고리의 다른 글
AWS EC2- CloudWatch, Slack 연동 CPU, Memory 사용량 모니터링 (0) | 2022.06.20 |
---|---|
EC2 프리티어 인스턴스 시작 - Ubuntu (0) | 2022.06.13 |
Cloud Storage 선정 과정 - block Storage, file Storage, object Storage (0) | 2022.06.06 |
apache2와 nginx 둘 다 설치되어있을 때 원하는 웹서버 따로 사용하는 법 (0) | 2022.04.05 |
docker 명령어 정리 - 내가 자주 사용하는 것들 (0) | 2022.04.03 |
댓글