The nginx webserver is pretty lightweight and can be build with the
addition of a rtmp-module. This module adds a whole “media server” to nginx.
The feature list is pretty extensive and can be found here.
I got help by dodgepong’s guide on the OBS forum, but I changed it very slightly and will add some parts. First of all I am doing this setup on Ubuntu 13.4/64bit with a simple standard installation running on a Virtual Machine. You can use VMware player or even grab a complete VirtualBox image which is already configured with nginx right here. If you are using your own Linux installation, no matter if its a VM or dedicated PC, you will need the following packages for the building of nginx+rtmp module.
I got help by dodgepong’s guide on the OBS forum, but I changed it very slightly and will add some parts. First of all I am doing this setup on Ubuntu 13.4/64bit with a simple standard installation running on a Virtual Machine. You can use VMware player or even grab a complete VirtualBox image which is already configured with nginx right here. If you are using your own Linux installation, no matter if its a VM or dedicated PC, you will need the following packages for the building of nginx+rtmp module.
sudo apt-get
install build-essential libpcre3 libpcre3-dev libssl-dev
Next we need to grab the nginx sources and the latest rtmp module sources.
wget
http://nginx.org/download/nginx-1.6.2.tar.gz
wget
https://github.com/arut/nginx-rtmp-module/archive/master.zip
I tested nginx version 1.2.7 and 1.4.2 so far without problems. Now lets
extract both files to setup the make file.
tar -zxvf
nginx-1.6.2.tar.gz
unzip
master.zip
cd nginx-1.6.2
Make sure all folder names are correct, you might have to change some
settings according to the version you downloaded. To build and install nginx
now with the rtmp-module, we have to configure the add-module parameter and
then start building and finally install everything.
./configure
--add-module=../nginx-rtmp-module-master
$ make
$ sudo make
install
Thats it, if you get no error code you now have installed
nginx+rtmp-module. You can use the following command to open the nginx.conf in
a text editor (in my example gedit) with root privileges:
sudo gedit
/usr/local/nginx/conf/nginx.conf
In the next guide I will talk about different configuration options, but
for now I will give you the most simple rtmp server code for the config, and of
course the startup parameter:
rtmp {
server { listen 1935; chunk_size 4096; application live { live on; record off;
} } }
Add these line to the end of your nginx.conf. To start nginx, you just
enter this line:
sudo
/usr/local/nginx/sbin/nginx
And to stop nginx you use this:
Sudo /usr/local/nginx/sbin/nginx -s stop
And streaming to this server is just as simple:
Streaming
Service: Custom
Server:
rtmp://serverip/live
Play
Path/Stream Key: test (or whatever)
Be sure to check out my second guide for some usage examples, and more info
on how to stream to this server, or use it to forward streams. And as always,
if you have questions, just post them below.
No comments:
Post a Comment