学习之Linux技术Code学习空间

Linux直播服务器搭建

2021-08-17  本文已影响0人  Peakmain
cd ~
mkdir rtmp
cd rtmp
yum install git -y
wget http://nginx.org/download/nginx-1.15.3.tar.gz
wget https://codeload.github.com/arut/nginx-rtmp-module/tar.gz/v1.2.1
nvm install v11.6.0 
git clone git://github.com/creationix/nvm.git ~/nvm
//设置nvm自动运行
echo "source ~/nvm/nvm.sh" >> ~/.bashrc
source ~/.bashrc
tar xvf v1.2.1
tar xvf nginx-1.15.3.tar.gz
yum install git
cd nginx-1.15.3
yum -y install pcre*

openssl

//openssl
yum -y install openssl*
./configure --prefix=./bin --add-module=../nginx-rtmp-module-1.2.1
make instal
//修改默认监听端口
vim nginx.conf

参数

user root;
worker_processes 1;
error_log /usr/local/peakmain/rtmp/nginx-1.15.3/bin/logs/error.log debug;
events {
       worker_connections  1024;
   }

   rtmp {
       server {
           listen 1935;#之后推流拉流的端
           application live {
               live on;
          }
      }
  }
  http{
          server{

                  listen 8080;
                  server_name  localhost;
                  location /stat.xsl
                  {
                          root /usr/local/peakmain/rtmp/nginx-rtmp-module-1.2.1;
                  }

                  location /stat {
                          rtmp_stat all;
                          rtmp_stat_stylesheet stat.xsl;
                  }
                  location /control{
                          rtmp_control all;
                 }
                  location -publisher
                  { #注意目录
                          root /usr/local/peakmain/rtmp/nginx-rtmp-module-1.2.1/test;
                  }
                  location / {
                          #注意目录
                          root /usr/local/peakmain/rtmp/nginx-rtmp-module-1.2.1/test/www;
                           }
                }
}

./bin/sbin/nginx -c conf/nginx.conf
image.png
image.png
上一篇下一篇

猜你喜欢

热点阅读