默认在/usr/local/src文件夹下
yum install gcc-c++
(安装c++编译环境)
wget https://netix.dl.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
wget http://nginx.org/download/nginx-1.8.1.tar.gz
(yum是安装工具,安装软件,wget是下载工具,下载网络上的资源)
(pcre是一个正则表达式库,让nginx支持rewrite功能,简单来说就是,就是我开了个web服务器, 让别人来访问, 但是我又不想让别人知道具体的路径或者文件名,可以隐藏路径和参数)
(zlib库,解压缩库)
(openssl库,主要有秘钥证书管理、对称加密和非对称加密 。)
(下载nginx)
tar zxvf openssl-fips-2.0.10.tar.gz
cd openssl-fips-2.0.10
./config && make && make install
。。。。。。。(省略重复安装步骤)
1.将所有的所需安装完成后,src目录应该如下图所示:
2.再次进入到nginx下:
./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../opensll-1.1.0e
3.在sbin目录下设置环境变量:
echo "PATH=$PATH:/usr/local/nginx/sbin" >> /etc/profile && source /etc/profile
4.启动nginx:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 或者 /usr/local/nginx/sbin/nginx
5.显示成功页:
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip(下载)
unzip master.zip(解压)
cd /usr/local/src/nginx-1.8.1(进入nginx文件夹下)
./configure --add-module=/usr/local/src/nginx-rtmp-module-master(完成rtmp模块安装)
make && make install (编译安装)
vim /usr/local/nginx/conf/nginx.conf
与http同级,直接加上
rtmp {
server {
listen 1935; #监听的端口
application live {
live on;
}
chunk_size 4000;
application hls { #rtmp推流请求路径
live on;
hls on;
hls_path /usr/local/nginx/html/hls;
hls_fragment 5s;
}
}
}
改写http下的root路径:
location / {
root /usr/local/nginx/html;
index index.html index.htm;
}
保存后:/usr/local/nginx/sbin/nginx -t
显示
直接官网下载obs,安装完成后。
开始推流即可。