系统环境

[root@yunwei-test live]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[root@yunwei-test live]# getenforce 
Disabled
root@yunwei-test live]# systemctl stop firewalld
[root@yunwei-test live]# hostname -I
10.0.3.56 
 

1、git拉取nginx-rtmp插件

mkdir -p /server/tools

cd /server/tools

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

 

2、编译安装nginx

[root@yunwei-test tools]# useradd -s /sbin/nologin -M nginx
[root@yunwei-test tools]# wget http://nginx.org/download/nginx-1.14.0.tar.gz
[root@yunwei-test tools]# tar xf nginx-1.14.0.tar.gz
[root@yunwei-test tools]# cd nginx-1.14.0/
[root@yunwei-test nginx-1.14.0]# yum install pcre-devel  openssl-devel.x86_64 -y
[root@yunwei-test nginx-1.14.0]# ./configure --user=nginx --group=nginx --with-http_ssl_module --prefix=/application/nginx --add-module=../nginx-rtmp-module  #rtmp模块的路径
[root@yunwei-test nginx-1.14.0]# make && make install

 

3、配置启动nginx

cd /application/nginx/conf/
grep -Ev '^$|#' nginx.conf.default >nginx.conf
vim nginx.conf
worker_processes 1;

events {

worker_connections 1024;

}

rtmp {

server {

listen 1935;

chunk_size 4096;

application live {

     live on;

hls on;

hls_path /application/nginx/html/live;

hls_fragment 5s;

}

}

}

 

http {

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {

listen 80;

server_name localhost;

location /live {

types {

application/vnd.apple.mpegurl m3u8;

video/mp2t ts;

}

alias /application/nginx/html/live;

expires -1;

add_header Cache-Control no-cache;

}

location / {

root html;

index index.html index.htm;

}

}

}

 

#测试nginx语法

../sbin/nginx –t

启动nginx

../sbin/nginx
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-10-06
猜你喜欢
  • 2021-07-17
  • 2021-12-05
  • 2022-12-23
  • 2022-01-18
  • 2021-10-14
  • 2021-12-05
  • 2021-05-27
相关资源
相似解决方案