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 https://raw.githubusercontent.com/upggr/UPG.GR-MEDIA-SERVER/master/nginx.sh | sudo bash –

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

1

Step 2

Enter your email and select a password

2

 

Step 3

Activate your account and login to get your free credit

3

 

Step 4

Create a new droplet

4

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 upg.gr enter “streamer.upg.gr”. If you do not have domain just enter there whatever and you will access your server with the ip you will be provided.

5

Step 6

Select a country near you.

6

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.

7

Step 8

Create droplet :

8

Step 9

Wait for your droplet to be created

9

Step 10

Check your email for your login credentials

10

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 (http://cloudflare.com)

11

Step 12

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

12

 

13

 

Step 13

Login using the credentials you are provided in your email

14

Step 14

Enter “sudo -s”

15

Step 15

Enter “sudo apt-get install curl -y”

Enter “curl -sL https://raw.githubusercontent.com/upggr/UPG.GR-MEDIA-SERVER/master/nginx.sh | sudo bash -”

16

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 !

17

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 :

https://github.com/upggr/UPG.GR-MEDIA-SERVER   –  Automation

https://github.com/upggr/nginx – Fork of the latest working nginx server (1.9.2)

https://github.com/upggr/nginx-rtmp-module – 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.

Canada Business Directory

Have a look at my new project : http://canadawhiz.com/

This is a full Canadian Business Directory. The database is one year old and is derived from the official gov website. More than 1 million records are included in this database and this website is a way to interact with all this data-set.

Some of the services offered by this project are :

  • Purchasing of the current dataset
  • Purchasing of corrections to existing data

This project is made using php/mysql and some simple functions to query and filter the results securely. Importing the data was quite challenging as they came in a CSV file. After trying for ages to find the best way to import such a file to mysql, I ended up importing it using windows ODBC and ms access. If you need more information on that, I will be happy to help or create a mini guide on that 🙂

I will also be happy to provide you with the full source so that you can run a similar project, if you request it nicely in the comments.

Connectwise Analytics

This project was done on my spare time mostly, for the company I work for. It digs into the connectwise and labtech databases pulling interesting data, presenting them in a nice jquery way. Ideal for your NOC board monitors or your management executive boards / meetings.

Here are some screenshots (company names and technicians’ names are blanked :

I am tempted to release this as opensource. I would love to get some beta testers. The only thing you need to run it on your server is php,mssql extensions and a read only user for labtech and connectwise (or only connectwise.) All configuration is done on a single config file.

 

GreekTV for ROKU

This is the ROKU application all Greeks abroad were waiting for!

Have you seen all those expensive services with monthly prices up to $40 ? Well this one is only $2.99 and you get all the major channels plus some other minor ones.

There is a Lite (ad supported) version here : https://my.roku.com/add/MPGJ9QC  (Canada, UK)

There is a paid (no ads) version here :  https://my.roku.com/add/greektvupg ($2.99 a month only) (Canada, US, UK, Rest of the World)

You can also add the above by just searching in the Roku channel store for “GreekTV”

I would really love to hear your feedback or suggestions for this project. I am also running a facebook page for it : https://www.facebook.com/greektvroku

You will be needing a Roku Player for this to work :

 

UPG Syslog Server

This is a minimal syslog server. A single executable that once executed will start listening on port 514 (default syslog port). Once syslog traffic kicks in it will create a text document in a nice format in the same folder. Once the day changes another document will be created.

This is a quick way to monitor and collect logs. It might be wise to compress the folder where you are running it if you plan to run it for days. I have written this in .NET. Watch this space for the source soon.

Note that you would need .NET for this to work. Here is an idea, fire up a server in the Azure, and run this on the desktop for as long as you wish to collect logs from devices for troubleshooting 🙂

 

Download the UpgSyslogServer

syslog

x-mad.com

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!

https://github.com/upggr/x-mad

onlinemovies.pw

IMDB SCRAPER – WORDPRESS IMPORTER – MAGNET CRAWLER

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 : onlinemovies.pw

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 : easycron.com. This way you can just call http://yoursite.com/wp-content/themes/upg1/cron/enter.php 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!