Created
May 13, 2025 11:09
-
-
Save Vortexdude/84331b4627a4c91f8c4d9b03bedf95c7 to your computer and use it in GitHub Desktop.
Setup the RTMP live stream server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ $EUID -ne 0 ]; then | |
echo "The script must run with sudo privileges." | |
exit 1 | |
fi | |
apt update -y | |
apt install -y build-essential libpcre3 libpcre3-dev libssl-dev ffmpeg git wget curl | |
cd /opt | |
git clone https://github.com/arut/nginx-rtmp-module.git | |
wget http://nginx.org/download/nginx-1.21.6.tar.gz | |
tar -zxvf nginx-1.21.6.tar.gz | |
cd nginx-1.21.6 | |
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module --without-http_gzip_module | |
make | |
make install | |
cat <<EOF > /usr/local/nginx/conf/nginx.conf | |
worker_processes 1; | |
error_log logs/error.log info; | |
pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
rtmp { | |
server { | |
listen 1935; | |
chunk_size 4096; | |
application live { | |
live on; | |
record off; | |
} | |
} | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log logs/access.log main; | |
server { | |
listen 8080; | |
server_name localhost; | |
#charset koi8-r; | |
#access_log logs/host.access.log main; | |
location / { | |
root html; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} | |
} | |
EOF | |
/usr/local/nginx/sbin/nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment