Linux Panel Series: Configuring PeerTube (HLS) Reverse Proxy Using Baota Panel (Nginx)
本文最后更新于 983 天前,其中的信息可能已经有所发展或是发生改变,如有失效可到评论区留言。
Article Abstract
When configuring the Pagoda Panel Nginx reverse proxy to support PeerTube HLS streaming, it was found that an HLS.js network error occurred when playing videos on Mac browsers, while the iPhone could play them but with severe latency. Through troubleshooting, it was discovered that the `proxy_buffering` and `proxy_cache` parameters enabled by default in Nginx have compatibility issues with HLS streaming. The issue was resolved after disabling these two parameters. This scenario involves a video sharing platform built on Docker, where special attention must be paid to the configuration of Nginx buffering and caching mechanisms during HLS streaming reverse proxying, validating the critical impact of reverse proxy parameters on transmission performance in streaming scenarios.
Qwen3-14B · 2026-06-18

After I set up PeerTube, I routinely used the Pagoda Panel (with its built-in Nginx) to configure the reverse proxy (as mentioned earlier, when setting up PeerTube Docker, you need to use the -e parameter to specify the domain name used to access PeerTube, whether to use HTTPS, and the port used. For specific steps, see:Docker Series: Building a PeerTube-Based Private Video Sharing Platform (Part 1)), but after configuring it, I found a problem: all other accesses were normal (configuration, uploading videos, etc.), but when playing videos, Safari and Chrome on iPhone seemed to be able to play them, but they were obviously much slower, buffering for a long time, while browsers on Mac (Chrome, Safari) just kept buffering and finally reported the following error:

image.png

This left me a bit confused. Why did the iPhone seem to work (albeit very slowly), but the Mac failed completely? I searched foreign forums for a long time using “HLS.js error: networkError – fatal: false – fragLoadError” and found various suggestions, but none of them were relevant to my current environment. There are only a few options on PeerTube, and none of them even seem remotely related. The problem shouldn't be related to PeerTube, so could it be related to Nginx? But I have configured countless reverse proxies on Pagoda Panel and never encountered any issues. What could be the reason?

I checked the videos stored on PeerTube, and they have all been transcoded into HLS:

image.png

Could there be something special about the Nginx reverse proxy configuration for HLS? After another round of searching and verification, I finally found that it indeed was, and it was related to two Nginx parameters: `proxy_buffering` and `proxy_cache`.

proxy_buffering

This is mainly to achieve asynchronous communication between the response data of the proxied server (application) and the client's request. Generally speaking, when Nginx acts as a reverse proxy for an application, it is highly likely in the same local area network as the application. Compared to the client, the network quality between Nginx and the application is more trustworthy. Therefore, after the client request reaches Nginx and is forwarded by Nginx to the application, Nginx will first place the response from the proxied server (application) into its own "buffer", and then decide when to start returning the response data to the client based on the value set by "proxy_busy_buffer_size". During this process, if all buffers are full, the data will be written to a temp_file. If this feature is turned off, Nginx will directly return the response packet received from the application to the client.

proxy_cache

This is mainly to cache the response data obtained from the proxied server (application) onto Nginx according to preset rules. When a client request reaches Nginx, Nginx will directly return the cached response data (if any) to the client, without needing to fetch it from the proxied server (application) every time. This saves the resources of the proxied server and also improves the speed at which the client obtains the response. If this feature is turned off, every time Nginx receives a request from a client, it will forward it to the application and then directly send the response data returned by the application back to the client.

`proxy_buffering` defaults to `on`, and `proxy_cache` theoretically defaults to `off`. Both features are related to how Nginx responds to client requests when acting as a reverse proxy. If both features are enabled at the same time and coexist with streaming media like HLS, will there be any “compatibility” issues? To verify this, I first tried to turn off `proxy_buffering`:

proxy_buffering off;   

Add it to the location block where the reverse proxy is located, as follows:

image.png

It didn't work. Then I also added turning off `proxy_cache`:

proxy_cache off;

image.png

Problem solved... This is really strange. Theoretically, `proxy_buffering on` should be a prerequisite for `proxy_cache` to take effect. Since `proxy_buffering` is already `off`, why must `proxy_cache off` be explicitly specified?

However, so far I have only found that this setting is related to streaming media with HLS enabled, whereas the links generated by the COS I built with MinIOhttps://*.xxx.mp4play fine in the browser without this setting. Maybe it is only related to streaming media? If you encounter similar problems when using Nginx as a reverse proxy for streaming media in the future, you can try this solution.

View Related Categories · 3 Matches
📌 Content Structure Prompt:
This content is part of the following knowledge map, where you can view the complete content path: Blog Knowledge Map。
📎 Related Articles
Share this article
The blog content is original, please indicate the source when reposting! The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if needed, you can join theTelegram Groupto discuss questions together.

Comments

  1. Hehehe
    Windows Chrome 131.0.0.0
    2 years ago
    2024-12-26 11:00:38

    I'm not using Pagoda Panel, but the host machine's Nginx proxy. Even after turning off the two settings mentioned in the article, I still can't watch videos, only upload them. If I don't use a proxy, I can watch videos, but then I can't use HTTPS, only HTTP. Could you please provide an Nginx template configuration?

    • Owner
      Hehehe
      Macintosh Chrome 131.0.0.0
      2 years ago
      2024-12-26 15:22:07

      What is your deployment environment like? An intranet environment? Or is Nginx reverse proxying PeerTube to the public network, forwarding access requests to the intranet?

      • Hehehe
        Tang Wudi
        Android SamsungBrowser 27.1
        2 years ago
        2024-12-28 14:14:47

        Thank you for your reply, it has been resolved. Changing the original http://127.0.0.1:port in the Nginx proxy to https://127.0.0.1:port made it work normally. Although I don't understand why, it indeed worked.

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗ
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Kaomoji
Emoji
Little Dinosaur
Flower!
Previous
Next
       

👋 Welcome to “Wudi's Personal Blog”

Here, long-term exploration is mainly carried out around the following directions:

🧱 Personal Digital Infrastructure and Blog System Construction
☁️ Cloudflare and Network Architecture Practice
🧠 AI and Knowledge System Exploration
🛡️ Network Security and Access Optimization
🎵 Music and Sound Cognition
👁️ Cognitive Perspectives and Worldviews