rtmp-server
Добавлено: 24 авг 2023, 22:31
To set up a simple RTMP server on Debian 9, you can use the Nginx web server with the RTMP module. The process involves the installation of Nginx and the RTMP module, and configuring the RTMP server. Follow the steps below to set up the server:
Update the system packages:
sudo apt-get update
sudo apt-get upgrade
Install the required tools and dependencies:
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev
Download and extract the Nginx and RTMP module source files:
wget http://nginx.org/download/nginx-1.21.1.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/refs/tags/v1.2.1.tar.gz
tar -zxvf nginx-1.21.1.tar.gz
tar -zxvf v1.2.1.tar.gz
Make sure to check for the latest version of Nginx (https://nginx.org/en/download.html) and the RTMP module (https://github.com/arut/nginx-rtmp-module/releases) and update the download links accordingly.
Compile and install Nginx with the RTMP module:
cd nginx-1.21.1
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-1.2.1
make
sudo make install
Configure the RTMP server:
Create a backup of the default Nginx configuration:
sudo cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.backup
Modify the Nginx configuration:
sudo nano /usr/local/nginx/conf/nginx.conf
Add the following RTMP configuration block at the end of the file, before the closing }:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}
Save and exit the text editor (Ctrl + X, press Y, then hit Enter in nano).
Start Nginx:
sudo /usr/local/nginx/sbin/nginx
Now your RTMP server should be up and running. You can send your live streaming to this server by connecting to the RTMP server URL:
rtmp://<your_server_IP_address>/live/<stream_key>
Replace <your_server_IP_address> with your server's IP address and <stream_key> with a unique string that you'd like to use as the stream key.
You can use video players like VLC to view the live stream using the following URL:
rtmp://<your_server_IP_address>/live/<stream_key>
To stop and restart Nginx, use the following commands:
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx
Update the system packages:
sudo apt-get update
sudo apt-get upgrade
Install the required tools and dependencies:
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev
Download and extract the Nginx and RTMP module source files:
wget http://nginx.org/download/nginx-1.21.1.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/refs/tags/v1.2.1.tar.gz
tar -zxvf nginx-1.21.1.tar.gz
tar -zxvf v1.2.1.tar.gz
Make sure to check for the latest version of Nginx (https://nginx.org/en/download.html) and the RTMP module (https://github.com/arut/nginx-rtmp-module/releases) and update the download links accordingly.
Compile and install Nginx with the RTMP module:
cd nginx-1.21.1
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-1.2.1
make
sudo make install
Configure the RTMP server:
Create a backup of the default Nginx configuration:
sudo cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.backup
Modify the Nginx configuration:
sudo nano /usr/local/nginx/conf/nginx.conf
Add the following RTMP configuration block at the end of the file, before the closing }:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}
Save and exit the text editor (Ctrl + X, press Y, then hit Enter in nano).
Start Nginx:
sudo /usr/local/nginx/sbin/nginx
Now your RTMP server should be up and running. You can send your live streaming to this server by connecting to the RTMP server URL:
rtmp://<your_server_IP_address>/live/<stream_key>
Replace <your_server_IP_address> with your server's IP address and <stream_key> with a unique string that you'd like to use as the stream key.
You can use video players like VLC to view the live stream using the following URL:
rtmp://<your_server_IP_address>/live/<stream_key>
To stop and restart Nginx, use the following commands:
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx