Launch new instance choose the amazon machine image ami amazon linux ami hvm
NGINX RTMP server Assignment Answers
Question:
How do you Setup a NGINX RTMP Server for Streaming on a AWS ami linux instance? Then Demo it through VLC, other media player, or other method (like Web)?
NGINX RTMP server Answer and Explanation
- Choose the Amazon Machine Image (AMI): Amazon Linux 2 AMI (HVM), SSD Volume Type.
- Select an instance type (e.g., `t2.micro` for a basic setup).
Step 2: Connect to Your EC2 Instance
1. Connect to your instance using SSH:
sudo yum install -y gcc pcre-devel zlib-devel openssl-devel
Step 4: Install NGINX with RTMP Module
2. Download the NGINX RTMP module:
git clone https://github.com/arut/nginx-rtmp-module.git
Step 5: Configure NGINX for RTMP
1. Create the NGINX configuration file:
worker_connections 1024;
}
keepalive_timeout 65;
server {
index index.html index.htm;
}
listen 1935;
chunk_size 4096;
}
}
sudo vim /etc/systemd/system/nginx.service
Add the following content:
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
[Install]
WantedBy=multi-user.target
#Streaming Video
1. Use a tool like OBS Studio to stream video to your NGINX RTMP server:
1. Using VLC:
- Open VLC.
- Create a simple HTML file with a web player (e.g., Video.js) that supports RTMP playback.
- Use the same RTMP URL in the player's source.
<link href="https://vjs.zencdn.net/7.11.4/video-js.css" rel="stylesheet" />
<script src="https://vjs.zencdn.net/7.11.4/video.js"></script>
</video-js>
</body>
By following these steps, you should have a functional NGINX RTMP server running on your AWS EC2 instance, capable of streaming video to clients like VLC or a web player.