This project provides an RTMP server with Nginx, conveniently packaged in a Docker container. It's perfect for streaming live content and supports custom configurations.
To quickly get the server running, use the following command:
docker run -d -p 80:80 -p 1935:1935 --name rtmp-server mparvin/nginx-rtmp-server:latest
If you want to run the server with a custom configuration, first download the configuration file:
wget https://github.com/MParvin/Nginx-RTMP-Docker/raw/master/nginx_rtmp_hls.conf
Then, run the server with the custom configuration:
docker run -d -p 80:80 -p 1935:1935 --name rtmp-server -v ./nginx_rtmp_hls.conf:/usr/local/nginx/conf/nginx.conf mparvin/nginx-rtmp-server:latest
If you want to build the Docker image locally, follow these steps:
-
Clone the repository:
git clone https://github.com/MParvin/Nginx-RTMP-Docker.git
-
Build the image:
docker build -t nginx-rtmp-server .
-
Run the image:
docker run -d -p 80:80 -p 1935:1935 --name rtmp-server nginx-rtmp-server
If you want to build the Docker image with Alpine Linux, instead of step 2, run:
docker build -t nginx-rtmp-server-alpine -f Dockerfile.alpine .
You can also use Docker Compose to run the server. Here’s an example docker-compose.yml file:
version: '3.3'
services:
nginx-rtmp-server:
ports:
- '80:80'
- '1935:1935'
container_name: rtmp-server
volumes:
- './nginx_rtmp_hls.conf:/usr/local/nginx/conf/nginx.conf'
image: 'mparvin/nginx-rtmp-server:latest'
To stream content, use the following settings:
- Server: rtmp://YOUR_SERVER_IP-OR-DOMAIN/show
- Stream key: ANY_STRING
If you have FFmpeg installed on your machine, you can use it to stream content to the server. Here's an example command:
ffmpeg -re -i /path/to/your/video.mp4 -c copy -f flv rtmp://YOUR_SERVER_IP-OR-DOMAIN/show/STREAM_KEY
To view the stream in a client (like VLC), use the following URL:
rtmp://YOUR_SERVER_IP-OR-DOMAIN/show/STREAM_KEY
You can also access the HTTP video URL at:
http://YOUR_SERVER_IP-OR-DOMAIN/hls/STREAM_KEY.m3u8
If you encounter any issues or need further assistance, feel free to contact me on Telegram at @MMPARVIN.
If you have any problem contact with @MMPARVIN in telegram.