Homebrew Nginx



Most people who stream enjoy using services such as Dacast, Twitch or Ustream to deliver Live video to viewers, and that works well. But sometimes you want some more further control over your own stream, or you want other people to be capable to stream to you on your server, or you want to stream to multiple places or any plenty of things that require you to have access to an exact RTMP stream from an RTMP server. This example will cover the basics of establishing a simple RTMP server on a Linux server.

A couple things you can do with your own RTMP server that you might be interested in:

I've recently been working on an Nginx Tap for Mac OS X Homebrew and now I think it's time to share with the world. Originally I created a pull request on the original repo but due to the custom nature of the modules I needed it was reccomended that I create a tap and maintain my own repository (tap). The main goal behind the tap is to create a version of Nginx with as many modules as possible. How to install NGINX, MariaDB and multiple PHP versions in macOS. A brief introduction about the application softwares discussed in this article.

  • Stream to multiple channels at the same time
  • Import other people’s streams to incorporate for your own purposes (like multiple camera angles)
  • RTMP Republishing and Playback
Homebrew nginx restart

RTMP is actually remarkably light on system resources. Essentially it just grabs data from the input and forwards it on to the output, simple data transfer.

in order to setup your Own RTMP Server a VPS. I especially recommend Vultr or Digital Ocean as providers. Just make sure you have sufficient bandwidth…remember that bandwidth usage will be (the size of a stream) * (the number of people uploading + the number of people downloading).

I recommend using Ubuntu for the server software for the sake of ease, but you can obviously use whatever you want.

Homebrew Nginx

Note to Windows users: If you want to use Windows, you can find Windows binaries for nginx with the RTMP module already included here: http://nginx-win.ecsds.eu/download/

Note to Mac users: You can install nginx with the RTMP module via Homebrew: http://brew.sh/homebrew-nginx/

If you are hosting your server in your home, you will have to forward TCP port 1935 to the box…this varies by router, so look up how to set up port forwarding for your router. Also, I recommend using a dynamic DNS service to overcome dynamic IP issues that come up with residential hosting.

make sure you have the necessary tools to build nginx using the following command:

Now nginx is installed! By default it installs to /usr/local/nginx, so to start the server run the following command:

Homebrew

to test to make sure nginx is running, point your browser to http://yourip and you should get the “Welcome to nginx!” page.

at this step open your config file, located by default at /usr/local/nginx/conf/nginx.conf and add the following at the very end of the file:

Restart nginx with:

Macos Brew Nginx

$ sudo /usr/local/nginx/sbin/nginx -s stop
$ sudo /usr/local/nginx/sbin/nginx

Mac

Your server should now be ready to accept RTMP streams! Let’s try it out.

Create a new profile in OBS, and change your Broadcast Settings :

You may be wondering where that play path “test” came from. Well, we just made it up, just now. You can basically make up any play path and stream to it, and put that path into an RTMP player, and it will play back. For simple purposes, authentication isn’t necessary in my experience.

Homebrew Nginx

Homebrew Nginx

You should now be able to start streaming to your server. If you hit “Start Streaming” and don’t get an error from OBS, that’s a good sign.

So how do you watch it? The easiest way to do so is with VLC (v2.1.0 or later). Just Open a Network Stream and enter in rtmp://<your server ip>/live/test as the URL. If it all worked right, then you should now be seeing your stream in VLC!

You now have a working RTMP server! Congrats!

  • Install Homebrew


    Paste that in a macOS Terminal or Linux shell prompt.

    The script explains what it will do and then pauses before it does it. Read about other installation options.

  • What Does Homebrew Do?


    Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

  • Homebrew installs packages to their own directory and then symlinks their files into /usr/local.

  • Homebrew won’t install files outside its prefix and you can place a Homebrew installation wherever you like.

  • It’s all Git and Ruby underneath, so hack away with the knowledge that you can easily revert your modifications and merge upstream updates.

  • Homebrew complements macOS (or your Linux system). Install your RubyGems with gem and their dependencies with brew.

  • “To install, drag this icon…” no more. Homebrew Cask installs macOS apps, fonts and plugins and other non-open source software.

  • Donate to Homebrew

  • Homebrew Blog

  • Analytics Data

  • Homebrew was created by Max Howell. Website by Rémi Prévost, Mike McQuaid and Danielle Lalonde.