1、部署nginx
1.1准备环境
1.1.1服务器资源
服务名称:测试环境服务器
IP:[请查看资源分配文档]
操作系统:CentOS 6.8 x64
1.2 安装nginx
1.2.1 nginx下载
nginx下载
nginx-http-flv-module下载
1.2.2 nginx安装
把nginx-1.16.1.tar.gz和nginx-http-flv-module-1.2.7.tar.gz,上传到/opt/tools目录下
创建nginx目录
# mkdir /usr/local/nginx
解压nginx和nginx-flv
# cd /opt/tools
# tar -zxvf nginx-1.16.1.tar.gz
# tar -zxvf nginx-http-flv-module-1.2.7.tar.gz -C /usr/local/nginx/
目录改名
# cd /usr/local/nginx
# mv nginx-http-flv-module-1.2.7 nginx-http-flv-module
安装nginx所需依赖项
yum -y install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel
安装nginx
# cd /opt/tools/nginx-1.16.1
# ./configure --prefix=/usr/local/nginx --add-module=/usr/local/nginx/nginx-http-flv-module
# make && make install
修改配置文件
# cd /usr/local/nginx
# vi conf/nginx.conf
修改为以下内容:
worker_processes 1;
events {
worker_connections 1024;
}
#rtmp配置
rtmp {
out_queue 4096;
out_cork 8;
max_streams 128;
server {
listen 1935;
application live {
live on;
record off;
gop_cache on;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80; #nginx的端口,默认是80
server_name localhost;
location / {
root html;