Skip to main content

RTMP HLS nginx php Server – The easy way





Tired of paying for Wowza media server? Unreal media server?
Tired of trying to find a decent tutorial on how to build your own nginx rtmp server with php and hls support?
UPG.GR has the solution for you with a few easy steps (as usual)
*Note that a referral link to digital ocean is included in this article that will grant you 10$ of credit to try for free with no obligations

If you are an advanced linux user and have your own linux box, just run the following command on any Ubuntu and your done! : curl -sL | sudo bash –

Step 1
Go to digital ocean and get a free account with 10$ credits (to use for a month)


Step 2

Enter your email and select a password



Step 3

Activate your account and login to get your free credit



Step 4

Create a new droplet


Step 5

Select the 10$ a month droplet. This will be enough for testing and for about 100 concurrent users. Enter the subdomain of a domain you control For example if you have a domain enter “”. If you do not have domain just enter there whatever and you will access your server with the ip you will be provided.


Step 6

Select a country near you.


Step 7

Select your favorite UBUNTU distro. Watch this space for a Centos tutorial – request it in the comments and I ll do it for you.


Step 8

Create droplet :


Step 9

Wait for your droplet to be created


Step 10

Check your email for your login credentials


Step 11

In the meantime go your registra or dns server to map the subdomain you chose to the ip of the server you got in your email. In my example I am using the free tier of cloudflare to manage my dns (


Step 12

Go back to digital ocean and start the console (or just putty to the ip on port 22 and authenticate)





Step 13

Login using the credentials you are provided in your email


Step 14

Enter “sudo -s”


Step 15

Enter “sudo apt-get install curl -y”

Enter “curl -sL | sudo bash -”


Step 16

Your server is up! you can test it on the address you specified. Port 80 and 1935 is open. port 80 for the player port 1935 for the streaming. You may stream using Adobe Media Encoder (free). Remember to use the h.264 codec and not the default VP6 !


Connect and start streaming

Step 17

Test your streamer by visiting the main interface on the subdomain you defined or the ip address you were provided. I have prepared 5 streams. stream1,stream2,stream3,stream4,stream518

Step 18

Review my github projects where you can find all the source code for this project.

There are 3 projects :   –  Automation – Fork of the latest working nginx server (1.9.2) – Latest fork of the rtmp module for nginx

You can edit the nginx.conf to suit you needs at : /usr/local/nginx/conf/nginx.conf

You can find the html files that show the web interface at : /usr/local/nginx/html


To do :

Web administration for nginx.conf options
Ftp server to edit the php files

Please comment here to encourage me to continue with this project.

Playing rtmp streams on a webpage

I don’t understand why there is no opensource way of playing an rtmp stream on a webpage using any of the free opensource players.

The only options available seem to be the flowplayer with a watermark and jwplayer again with a watermark. Then some others have released similar players with watermarks (again). Only premium versions seem to be able to play rtmp streams without watermarks. This is crazy.

Anyway, here is a way to create your own streaming player for the web with no watermarks and top quality for your streams. Soon I will be releasing a totally opensource project on Github about this..

So following my example you will be creating a flash rtmp player.

Just head to Adobe and download a trial version of Flash Builder. At the time of this post the version was 4.6

Install as usual, sign in with a free adobe id to activate the trial and create a new MXML application. Just use all the defaults!

Edit the main.mxml file and add something like this :


<s:VideoPlayer id="vidPlyr"
left="100" right="100"
top="100" bottom="100"
horizontalCenter="0" verticalCenter="0"
<s:DynamicStreamingVideoSource host="rtmp://" streamType="live">
<s:DynamicStreamingVideoItem streamName="stream" />



Go to Project – Export Release Build

Go where the project is and get the bin-release folder contents and upload them to your server. If you used all the defaults you will be able to access the video page at

You are done!!! Here is your watermark free rtmp streaming player. I believe you get the point and you can start renaming things as needed and adding code to fallback to mobile etc.

Watch this space for a full fallback player that I will be releasing soon. Comment here and I’ll release it sooner 🙂

This is just a torrent aggregator.

I made it open source, so you can have a look on my code and even fork it on github.
This simple website searches live and grabs the magnet links from multiple torrent websites and displays them for you on a minimal interface. I did not want to clutter the interface with a million options so I went minimal.

Just the filename and the link, nothing else, no seeds , no ratios. I have sorted the results by seeds, and this seems to work fine. Maybe it is not the best for the advanced user, but the idea was to recreate the process of a typical search user : Visit a torrent website, search and then list by seed. I have also grabbed the rss from itunes and some other websites to give some ideas to download.

Technologies used : ajax, jquery, javascript, php, web scrapping.

This website is ajax intentionally so that google does not index the results. Trying to keep it as legal as possible. Nothing is stored on the server, not even the search history, the website is made of a few static html files. Enjoy!


This is a wordpress theme! (UPG1) Upload it to a clean wordpress installation with no posts and follow instructions in the theme’s control panel.

What is special with this theme ? It spiders IMDB and get lots of information, thumbnails etc as posts.

You can see an example here :

Here are some basic instructions about theme, after you install it :

There are just a few points :

  • You can change the logo at : wp-content/themes/upg1/logo.png
  • You should enter your own “add this” code at line 12 of file wp-content/themes/upg1/header.php
  • To fill your site with information from IMDB you need to set a cron job to run at regular intervals (or run it manually). The script that fills the database is at : wp-content/themes/upg1/cron/enter.php . The easies way would be to just setup a “web cron” using a website such as : This way you can just call and you are done!
  • You need to edit line 63 and 70 of single-post.php with your affiliate codes
  • Remove all widgets, leave only the categories one!
  • Rename the Uncategorized category to All

Possible errors :

This will work on any enviroment. I have run it on mutliple server versions on digital droplets on digital ocean and worked fine. If you receive an error about curl_opt and open base dirs, make sure your php.ini does not limit your base dir to anything (open_basedir = none)

To get you started :

  1. Traffic : Create a youtube account and then fill it with trailers using a service like video swipper(amazing traffic)
  2. A great affiliate program with the best conversion ratio for this kind of websites : Affbeat (about 24$ per refferal, conversion rate about 1/1000 !!!!!
  3. You can host your site on digital ocean , just fire a wordpress droplet for 10$ a month. Then enable supercache and cloudflare. With this configuration you will be able to to withstand about 500 concurrent users easy!