Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To relay a live encoder feed through Ubuntu to YouTube, install NGINX with the third-party nginx-rtmp-module, configure a local RTMP application and a separate YouTube RTMPS destination, then publish from your encoder to the Ubuntu server. The module is not included automatically with the ordinary Ubuntu NGINX package. This guide explains the Open Source source-build route and how to verify each leg of the stream.

What you are installing—and how the stream flows

The nginx-rtmp-module is a third-party module for NGINX. It can accept an incoming RTMP stream and relay it to another destination; the project also lists optional capabilities such as HLS, recording and FFmpeg integration. Those extras are not prerequisites for a basic YouTube relay. See the module README.

The path is: encoder → your Ubuntu machine running NGINX → YouTube Live. The encoder connects to a local RTMP URL whose application name matches an NGINX application {} block. NGINX then connects outward to the YouTube RTMPS URL and authenticates with the stream key for that specific YouTube stream. Keep the local publishing address and YouTube destination distinct.

Choose the NGINX route that matches your installation

Route How it works Best fit and caveat
NGINX Open Source with community module Build NGINX with the module using a static --add-module or, where supported, a dynamic --add-dynamic-module build. For operators using Open Source NGINX. The module is third-party, and its build must match the NGINX source and binary you intend to run. NGINX cautions that third-party module stability is not guaranteed. NGINX Open Source installation and module guidance.
NGINX Plus with RTMP module NGINX documents an nginx-plus-module-rtmp package in the official NGINX Plus repository. For an existing NGINX Plus deployment, not a generic Open Source Ubuntu package. Follow the NGINX Plus RTMP module instructions.

The commands below outline the community-module source-build path. They are not a release-pinned recipe: package names and available NGINX versions depend on the Ubuntu release, and no tested version matrix is established here. Choose versions appropriate to your Ubuntu release and build the module against the NGINX source version you will actually run. Do not install one NGINX binary and load a module built against an unrelated version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Raspberry Pi 5 8GB
  • Raspberry Pi 5 with 8GB RAM: Model SC1112 featuring a quad-core ARM Cortex-A76 processor running at 2.4GHz. Enhanced Connectivity: Includes dual 4K micro HDMI ports, USB-C power input, and high-speed USB 3.0 ports. PCIe Expansion Support: FPC connector enables M.2 NVMe SSDs when using compatible adapters. Fast Storage Options: Works with microSD cards for booting, or optional NVMe storage for advanced projects. Built for Projects & Learning: Ideal for programming, home labs, DIY electronics, automation, and Linux-based development.

Build NGINX Open Source with the RTMP module

1. Prepare a compatible source build

Use an Ubuntu host you control, reachable from the encoder and able to make outbound connections to YouTube. The module project’s getting-started guide lists build tools and development headers including build-essential, PCRE development files, SSL development files, Git and zlib development files. That guide was last modified on 2020-03-23, so treat it as background rather than a current, release-specific package recipe: module getting-started guide.

Download the NGINX source and module source, then build NGINX from its source directory with the module path. The module README documents this pattern:

./configure --add-module=/path/to/nginx-rtmp-module
make
make install

Replace the example path with the actual module directory. The README also documents the local publishing URL format as rtmp://rtmp.example.com/app[/name]; use the NGINX hostname and application you configure, not the example hostname. Consult the NGINX installation guidance for Open Source build concepts and third-party module notes.

2. Configure an RTMP application and relay

Add an RTMP configuration block to the configuration used by the NGINX binary you built. A minimal relay has this shape; replace the destination placeholder with the RTMPS URL revealed in YouTube Live Control Room and supply the stream key securely as described below.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
rtmp {
    server {
        listen 1935;

        application live {
            live on;
            push rtmps://YOUTUBE_RTMPS_HOST/YOUTUBE_APP/STREAM_KEY;
        }
    }
}

This is a structural example, not a universal YouTube endpoint or a tested configuration for every NGINX build. The local encoder will publish to rtmp://YOUR_UBUNTU_HOST/live/STREAM_NAME: live must match the application block, while STREAM_NAME is the local stream name. Do not copy a YouTube key into a public configuration repository. Restrict access to configuration files and use a secret-management approach appropriate to your server; substitute the key only in a protected runtime configuration.

3. Validate before applying the configuration

Use the NGINX binary you intend to run to test its configuration before reload or restart:

Rank #3
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
  • Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz
  • 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
  • 2 × USB 3. 0 ports, 2 x USB 2. 0 Ports
  • 2 × micro HDMI ports supproting up to 4Kp60 video resolution
  • Micro SD card slot for loading operating system and data storage
nginx -t

NGINX documents nginx -t as a configuration check. If it reports an error, correct the indicated file and line before applying changes; do not treat a successful syntax test as proof that the module and end-to-end relay work. Check the NGINX error log while testing. See NGINX’s module documentation for its documented configuration-test approach.

Get the YouTube RTMPS URL and key

  1. Open YouTube Live Control Room and create or open the stream you intend to send.
  2. In that stream’s settings, open Stream settings and use the lock control to reveal the RTMPS URL.
  3. Copy the stream key associated with that specific stream. Keep it private; anyone who obtains it may be able to send video to your broadcast.
  4. Use that RTMPS destination and key only for NGINX’s outbound relay leg. The encoder publishes to your Ubuntu server’s local rtmp:// address, not directly to the YouTube URL.

YouTube describes RTMPS as “a secure extension to the popular RTMP streaming video protocol” and explains that it uses TLS/SSL. Its current instructions for obtaining the endpoint and troubleshooting are at Encrypt your stream using RTMPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publish from an encoder and verify the two legs

OBS Studio

In OBS, open Settings → Stream, choose a custom streaming service, and enter the Ubuntu server’s RTMP address as the server and the local stream name as the key. For the example configuration, those values correspond to rtmp://YOUR_UBUNTU_HOST/live and STREAM_NAME. Labels can vary by OBS version. Start streaming, then check the NGINX logs and YouTube’s live preview separately.

Rank #4
Sale
Raspberry Pi 5 (16GB RAM) – SC1113 | 2.4GHz Quad-Core, PCIe Support, Dual 4K HDMI, USB-C Power | Latest Model
  • Broadcom BCM2712 2.4GHz quad-core 64-bit Arm Cortex-A76 CPU, with cryptography extensions, 512KB per-core L2 caches and a 2MB shared L3 cache
  • Dual-band 802.11ac Wi-Fi Bluetooth 5.0 / Bluetooth Low Energy (BLE)
  • 2 × USB 3.0 ports, supporting simultaneous 5Gbps operation / 2 × USB 2.0 ports
  • Gigabit Ethernet, with PoE+ support (requires separate PoE+ HAT)
  • The Raspberry Pi 27W USB-C Power Supply is recommended for delivering the power you need to keep you Raspberry Pi running at peak performance

FFmpeg

The module project’s introductory guide shows FFmpeg as an example publisher. The important destination pattern is the local NGINX application URL, not YouTube’s RTMPS endpoint:

ffmpeg -re -i input.mp4 -c copy -f flv rtmp://YOUR_UBUNTU_HOST/live/STREAM_NAME

This illustrates the publishing destination; it is not a claim that every input file’s codecs or timestamps are compatible with stream copy. The module guide is available at Getting started with nginx-rtmp. No end-to-end stream test is established by this example.

Test privately before broadcasting publicly

  • Confirm the encoder can reach the Ubuntu host on the configured RTMP listening port and that the host firewall permits the connection.
  • Confirm the local URL’s application name matches the configured application block.
  • Check NGINX logs for the inbound publish and outbound push, then confirm YouTube receives video in its live preview.
  • Use a private or unlisted broadcast while validating; verify YouTube’s current live-stream requirements and copyright rules before making a stream public.

Troubleshooting common relay failures

Symptom Likely cause What to check
NGINX rejects the configuration or does not recognize rtmp. The running NGINX binary lacks the module, the module build is incompatible, or the RTMP block is in the wrong configuration context. Confirm the binary/module pairing and configuration placement; run nginx -t before applying changes. Ordinary Ubuntu NGINX packages do not automatically imply RTMP support.
Encoder cannot connect to the Ubuntu server. Wrong hostname or port, firewall/network path blocked, or NGINX not listening where expected. Check the configured listen port, local RTMP URL, server reachability and inbound firewall rules.
NGINX accepts the encoder, but YouTube shows no incoming stream. Outbound target or key is wrong, YouTube stream settings do not match, or the outbound connection fails. Re-copy the RTMPS URL and key from the intended stream’s Live Control Room settings; inspect NGINX logs and YouTube’s preview.
YouTube reports an SSL or secure-connection error. The outbound protocol may not be RTMPS, or the TLS connection is failing. Confirm the destination begins with rtmps://. YouTube says trying port 443 may help in some SSL-error cases; follow the current endpoint and troubleshooting guidance in its RTMPS help page.
YouTube receives a stream but rejects or interrupts the broadcast. Possible stream-setting, account, content-rights or live eligibility issue rather than an NGINX installation failure. Review the status and notices in Live Control Room and YouTube’s current rules. Do not assume a successful local relay overrides platform requirements.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a self-hosted relay is the right choice

A self-hosted NGINX relay is useful when you need control over an RTMP ingest point and are comfortable maintaining a compatible build, server configuration, network access and secret handling. An Ubuntu VPS or other reachable Ubuntu machine can host it; the software does not itself provide the host or guarantee performance, latency or uptime. Build and connection behavior depend on the versions and infrastructure you choose.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
UCTRONICS 19” 1U Rack Mount for Raspberry Pi with SSD Mounting Brackets, Thumbscrews Front Removable Bracket Supports Up to 4 Raspberry Pi 5, 3B/3B+, 4B and 4 SSDs, Option SD Card Adapter
  • Design for Raspberry Pi: Supports installation of 4 Raspberry Pis and 4 ssds, compatible with any 2.5” Solid State Drive (7mm/9mm) and Rpi 4B/3B+, and other B/B+ models.
  • The SSD mounting bracket also has two holes reserved for the SD card extension adapter ASIN: B09CKRDFTH, which allows you to access the SD card from the front of the rack.
  • Easy to Setup: Just use two included thumbscrews to mount the rackmount, which adopts a screw-in design, which helps you install and replace quickly and easily, no tools needed!
  • Applications: This is a hardware solution to get ingenious use of the Raspberry Pi, with this kit and open source software OpenMediaVault, you can use the Pi as a NAS Server, Surveillance station, or even a Web server.
  • Optional accessories: Single mounting bracket: B09GFQLPTY; Micro SD card extension adapter ASIN: B09CKRDFTH. I/O Panel: B09FXRQPFM

Or let it run in the cloud

If your goal is simply to keep uploaded videos looping as a YouTube live stream, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; the stream runs from the cloud rather than your Ubuntu computer. It plays uploaded videos, not a live camera feed, and it streams to YouTube only.

  • One flat price per slot for any uploaded quality up to 4K 60fps, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card, one free day per account.
  • Monthly: $9.99 per month.

Visit StreamNeo to see the service, or start the free first day.

Frequently Asked Questions

Does this procedure install the RTMP module into Ubuntu’s stock NGINX package?

No. The Open Source route here builds NGINX with the third-party module; NGINX Plus has a separate documented package route.

Can I use this relay to send a camera feed directly to YouTube?

Yes, if your encoder publishes that feed to the configured local RTMP application; the cloud alternative described above instead plays uploaded videos.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
Bestseller No. 3
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz; 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
$92.97
SaleBestseller No. 4
Raspberry Pi 5 (16GB RAM) – SC1113 | 2.4GHz Quad-Core, PCIe Support, Dual 4K HDMI, USB-C Power | Latest Model
Raspberry Pi 5 (16GB RAM) – SC1113 | 2.4GHz Quad-Core, PCIe Support, Dual 4K HDMI, USB-C Power | Latest Model
Dual-band 802.11ac Wi-Fi Bluetooth 5.0 / Bluetooth Low Energy (BLE); 2 × USB 3.0 ports, supporting simultaneous 5Gbps operation / 2 × USB 2.0 ports
$330.00

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.