DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
live streaming

How to Install NGINX RTMP on Ubuntu and Relay a Stream to YouTube

A practical guide to the Open Source NGINX RTMP source-build route on Ubuntu, with a YouTube RTMPS relay configuration, secure key handling, testing, and troubleshooting.

By VGSources Team 8 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To send a live stream through an Ubuntu server to YouTube, build NGINX with the third-party nginx-rtmp-module, configure an RTMP application on the server, and have that application forward to the RTMPS address and stream key shown in YouTube Live Control Room. The encoder connects to your Ubuntu server; the YouTube stream key is used only on the server’s outbound connection.

This guide covers the Open Source, community-module route. It is a source build, not an instruction to install the ordinary Ubuntu nginx package and assume RTMP directives are included. Commands below are an illustrative build workflow, not a tested recipe for every Ubuntu release or NGINX version. Match the module to the exact NGINX source/build you intend to run.

Choose the right NGINX RTMP route

nginx-rtmp-module is a third-party module. For NGINX Open Source, its documented route is to compile NGINX with the module, either statically or, where supported, as a dynamic module. NGINX cautions that third-party module stability is not guaranteed. A prebuilt NGINX binary and a module built against a different NGINX version are not interchangeable by default.

Route Workflow Best fit
NGINX Open Source plus community module Build NGINX from source with the module; static linking is the straightforward route documented by the module project. A compatible dynamic build is another option when supported. Operators who want the Open Source stack and can manage source builds and upgrades.
NGINX Plus RTMP module NGINX documents nginx-plus-module-rtmp as a package from the official NGINX Plus repository. Operators already using NGINX Plus. It is not a generic package for Ubuntu’s ordinary Open Source NGINX installation.

The module README describes the source-build approach. Its master branch is not a version pin, so choose a module revision deliberately and keep it compatible with the NGINX source. The module’s getting-started wiki lists build utilities including build-essential, PCRE development files, SSL development files, Git, and zlib development files; that guide was last modified on 2020-03-23, so verify package names and build requirements for your Ubuntu release rather than treating its old version example as current.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Prepare the Ubuntu host and matching source

Use an Ubuntu host that can accept an inbound connection from your encoder and make an outbound TLS connection to YouTube. It may be a server you already operate or an always-on hosted machine. Before building, record your Ubuntu release and the NGINX version you intend to run. Obtain the NGINX source and the module source from their respective project-maintained distribution channels, and do not substitute an unrelated system binary after compiling.

  1. Install build prerequisites. On Ubuntu, refresh package metadata and install the compiler/build tools and development libraries required by the chosen NGINX source and module. The module’s older getting-started guide names build-essential, PCRE, SSL, Git, and zlib development packages; confirm the exact package names for your release before running apt install.
  2. Unpack the chosen NGINX source and module source. Keep both source trees accessible. Select a released NGINX version and a compatible module revision rather than relying on a floating branch for a production installation.
  3. Configure the build from the NGINX source directory. The module README’s static-build pattern is ./configure --add-module=/path/to/nginx-rtmp-module. Replace the path with the actual module source directory. Preserve any configure options required by your deployment; the resulting binary should be the one you install and run.
  4. Compile and install. Run make and then make install from the configured NGINX source directory, following the layout and service-management approach appropriate to your host. These steps do not automatically replace or safely integrate with every Ubuntu-packaged NGINX installation.
  5. Verify which binary will run. Check the service configuration and executable path so you do not start a different NGINX binary that lacks the RTMP module. If you choose a dynamic build instead, the module must be compatible and loaded through NGINX configuration.

NGINX’s Open Source documentation distinguishes static third-party modules, configured with --add-module=<PATH>, from dynamic modules, configured with --add-dynamic-module=<PATH> where the module supports that mode. Dynamic modules require a corresponding load_module directive and a compatible NGINX build. For a first installation, the module project’s documented static route avoids the extra loading step.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Configure a local RTMP application and YouTube relay

The local publishing address follows the form rtmp://host/app/name. The app portion must correspond to an application {} block in the RTMP configuration. In a relay, the encoder publishes to that local application; the application forwards the incoming stream to YouTube’s RTMPS endpoint using the stream key for the intended YouTube stream.

Add an RTMP configuration in the context supported by your NGINX build, commonly an rtmp {} block in the main configuration. This example shows the relationship between the local application and the outbound YouTube destination; replace the placeholders with values from your own YouTube Live Control Room:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;
            record off;

            push rtmps://YOUTUBE_RTMPS_HOST/YOUTUBE_APP/YOUTUBE_STREAM_KEY;
        }
    }
}

The destination above is a structural example, not a universal YouTube URL. Use the exact RTMPS URL YouTube provides for the specific stream and append or place the stream key exactly as required by that destination format. Keep the key private: do not commit it to a public repository, paste it into a public support post, or expose it in a shared configuration. Restrict access to the server configuration and rotate the key in YouTube if it is disclosed.

The record off; setting is included because local recording is not needed for a basic relay. HLS, DASH, recording, and FFmpeg integration are optional capabilities of the module, not prerequisites for forwarding a live stream.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Open the network path carefully

  • Allow inbound TCP on the port where NGINX listens for RTMP (1935 in the example) only from the encoder’s address or trusted network when possible.
  • Allow the Ubuntu host to make outbound TLS connections to YouTube. The outbound connection is distinct from the encoder’s local RTMP connection.
  • Do not expose an unauthenticated publishing endpoint to the public internet without considering who can publish to it. Use network restrictions and an appropriate access-control design for your environment.
  • If the server is behind a firewall, cloud security group, or NAT gateway, check that the inbound rule and any forwarding point to the Ubuntu host. The encoder’s RTMP URL must use a reachable address for that host.

Find the current YouTube RTMPS URL and key

  1. Open YouTube Live Control Room and select or create the stream you intend to relay.
  2. Open that stream’s settings and locate the stream key. Copy the key for this stream; do not reuse a key by guesswork.
  3. In Stream settings, use the lock control to reveal the RTMPS URL, then copy the address YouTube displays.
  4. Put the RTMPS destination and key into the server-side forwarding configuration, keeping the key out of public source control.

YouTube describes RTMPS as RTMP over a TLS/SSL connection. Do not replace the Control Room destination with a guessed universal endpoint: use the address for the specific stream.

Validate, start, and test the relay

  1. Check the configuration before applying it. Run nginx -t using the exact NGINX binary and configuration path that the service will use. Correct syntax errors before reload or restart.
  2. Start or reload the matching NGINX service. Use the service mechanism and configuration path for your installation. Confirm the running process is the NGINX build that includes RTMP support.
  3. Set the encoder destination. In OBS, choose a custom streaming server and set the server to rtmp://YOUR_UBUNTU_HOST/live; set the stream name/key to a unique local name such as test. The URL’s live app must match the configuration’s application live. Do not put the YouTube key in OBS for this relay setup.
  4. Publish a private or unlisted test. Start the encoder and inspect YouTube’s live preview and status in Live Control Room before making the stream public.
  5. Check both legs if it fails. Read the NGINX error log for local listener, configuration, or push errors, and check YouTube Live Control Room for ingest status. A successful encoder connection to NGINX does not prove that the server has connected to YouTube.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failure points

Symptom Likely cause What to check
NGINX reports an unknown rtmp directive. The running binary was built without the module, or a dynamic module was not loaded. Confirm the service uses the intended build. For a dynamic module, verify the compatible module file and load_module directive.
Encoder cannot connect to the local server. Wrong host, application path, listener port, firewall rule, or service. Check that the encoder can reach the Ubuntu host, NGINX is listening on the configured port, the network permits the connection, and the URL app name matches the application {} block.
Encoder connects, but YouTube receives no stream. The outbound RTMPS destination or stream key is wrong, or the Ubuntu host cannot reach YouTube. Re-copy the exact RTMPS URL and key from the selected stream’s settings; inspect NGINX logs and YouTube’s live preview separately.
YouTube reports an SSL or secure-connection error. The destination may use the wrong protocol or a TLS connection cannot be established. Confirm the URL starts with rtmps. YouTube’s troubleshooting guidance says trying port 443 may help with some SSL errors; use it only where it fits the URL and network configuration YouTube provides.
Configuration test passes but reload fails or no RTMP listener appears. The test, reload, and running service may be using different binaries or configuration files. Use the same executable and config path for validation and service operation, then inspect service status and logs.
YouTube preview is live, but the stream is blocked or removed. The content or channel may trigger YouTube policy or copyright enforcement. Use content you have rights to stream and review YouTube’s current live-stream and copyright rules. Technical relay success does not grant permission to broadcast material.

Account for copyright and reused content

A relay only transports the encoder’s signal; it does not establish that you own or may broadcast the material. Use original content or content for which you have the necessary rights, including rights to music, game footage, and other included media. YouTube may apply its own copyright and channel policies regardless of whether the video is sent directly or through NGINX. A stream that loops prerecorded material also remains subject to YouTube’s rules and monetization policies; technical availability is not an approval of reused content.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Or let it run in the cloud

If the goal is simply to keep uploaded video live on a YouTube channel, rather than to operate your own RTMP relay, StreamNeo is a cloud alternative. Upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops the uploaded video from the cloud, so no computer or home connection has to stay on.

  • Nothing has to stay on at home; StreamNeo runs the loop in the cloud and can recover automatically if YouTube drops the stream.
  • Videos stream as uploaded, up to 4K 60fps, at one price per slot regardless of quality.
  • The first day is free with no card required. The monthly price is $9.99 per month.
  • Each slot includes one always-on YouTube stream, 10 GB storage per slot pooled across active slots, looping and playlists, and support from the StreamNeo team.

StreamNeo plays uploaded videos; it does not relay a live camera feed. See StreamNeo or current plan details. Start the free first day.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.