系统 centOS7 系统
用root用户登录
将目录文件拷贝到 /root 目录下
1.开放iptables 1935 1936 80 端口
sudo gedit /etc/sysconfig/iptables
增加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1935 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1935 -j ACCEPT
2.安装依赖包
yum install gcc gcc-c++ ncurses-devel perl gzip zlib pcre OpenSSL openssl-devel readline-devel perl-devel perl-ExtUtils-Embed libxml2 libxml2-devel libxslt libxslt-devel pcre-devel
3.安装nginx-1.8.0
执行
tar -zxvf /root/nginx-1.8.1.tar.gz
cd /root/nginx-1.8.0
./configure --user=root --prefix=/root/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_xslt_module \
--with-http_perl_module \
--with-ld-opt="-Wl,-E" \
--with-mail \
--with-http_gzip_static_module \
--add-module=/root/nginx_mod_h264_streaming-2.2.7/ \
--add-module=/root/nginx-rtmp-module/
vim objs/Makefile (修改objs/Makefile文件, 去掉其中的"-Werror")
make
make install
5.启动nginx
将目录的nginx.conf 替换 /root/nginx/conf/nginx.conf
将目录的html替换 /root/nginx/home
把想要播放的mp4、flv视频文件放在/root/nginx/html下
执行
./root/nginx/sbin/nginx
service iptables restart
调用 rtmp://ip:1935/vod/XXX.mp4 即可播放视频流
调用 http:/ip:80/status 查看当前nginx请求连接数
配置防火墙方法1
// 重启防火墙
[root@localhost /]# cd /etc/sysconfig
[root@localhost /]# vim iptables
[root@localhost sysconfig]# service iptables restart
配置防火墙方法2
配置防火墙增加端口
sudo firewall-cmd --permanent --zone=public --add-port=8090/tcp
sudo firewall-cmd --permanent --zone=public --add-port=8070/tcp
重启防火墙
sudo systemctl restart firewalld
重新加载防火墙
用root用户登录
将目录文件拷贝到 /root 目录下
1.开放iptables 1935 1936 80 端口
sudo gedit /etc/sysconfig/iptables
增加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1935 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1935 -j ACCEPT
2.安装依赖包
yum install gcc gcc-c++ ncurses-devel perl gzip zlib pcre OpenSSL openssl-devel readline-devel perl-devel perl-ExtUtils-Embed libxml2 libxml2-devel libxslt libxslt-devel pcre-devel
3.安装nginx-1.8.0
执行
tar -zxvf /root/nginx-1.8.1.tar.gz
cd /root/nginx-1.8.0
./configure --user=root --prefix=/root/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_xslt_module \
--with-http_perl_module \
--with-ld-opt="-Wl,-E" \
--with-mail \
--with-http_gzip_static_module \
--add-module=/root/nginx_mod_h264_streaming-2.2.7/ \
--add-module=/root/nginx-rtmp-module/
vim objs/Makefile (修改objs/Makefile文件, 去掉其中的"-Werror")
make
make install
5.启动nginx
将目录的nginx.conf 替换 /root/nginx/conf/nginx.conf
将目录的html替换 /root/nginx/home
把想要播放的mp4、flv视频文件放在/root/nginx/html下
执行
./root/nginx/sbin/nginx
service iptables restart
调用 rtmp://ip:1935/vod/XXX.mp4 即可播放视频流
调用 http:/ip:80/status 查看当前nginx请求连接数
配置防火墙方法1
// 重启防火墙
[root@localhost /]# cd /etc/sysconfig
[root@localhost /]# vim iptables
[root@localhost sysconfig]# service iptables restart
配置防火墙方法2
配置防火墙增加端口
sudo firewall-cmd --permanent --zone=public --add-port=8090/tcp
sudo firewall-cmd --permanent --zone=public --add-port=8070/tcp
重启防火墙
sudo systemctl restart firewalld
重新加载防火墙
sudo firewall-cmd --reload
代码和工具见附件