Nginx failed by itself, HLS js errors

Yesterday afternoon I found out my Peertube site was down. The Nginx service was stopped.
Starting it again didn’t work. The nginx error log reads the following:

[emerg] 430251#430251: unexpected end of file, expecting « } » in /etc/nginx/sites-enabled/peertube:275

Strange, since I did not make any recent edits to this file. Maybe it was needed when upgrading from 4.x to version 5, I cannot really remember.
So I added the missing } character to the end of the ‹ peertube › file and Nginx started again and my site started working again. Yay!
But this was not all. Some video’s suddenly don’t play anymore. The error message those videos give is:

*Failed to play video *
*The video failed to play due to technical issues. *

HLS.js error: networkError - fatal: false – fragLoadError

I am totally in the dark about what happened. I upgraded to version 5 a while ago and did not seem to have any issues. Uploaded a few videos after the upgrade and theyed play fine.
My server is a virtual Ubuntu 22 LTS server. No noticeable errors for the rest. The server uptime was 15 days so it didn’t get rebooted. Also checked /var/log/apt/history.log to see if any updates were installed which could have broken Peertube. None.
I monitor my server with Zabbix and no errors appeared. I hope anyone can give some advice or shed some light on what might have been going wrong.
I can always restore a backup from last weekend but what happened is a mystery so far.

Update: I did several network speed tests, nothing out of the ordinary. A short video played fine the first time, seconds time it gave the fragload error.
Sometimes after waiting a long time, a video starts to play. It seems very random and not connected to any network related issues.
Also I did not make any changes to the configuration of Peertube.

Hello,

Can you paste the URL of a broken video and the content of your nginx configuration?

Hello,

My Nginx config is here:

nginx.conf: /etc/nginx/nginx.conf - Pastebin.com

Do you need the peertube file under /etc/nginx/sites-enabled too?

Just tried this video, yesterday it DID work when I tried it but now it throws the error again:

Yes, it’s the one I need.

From what I see you server is too slow to send the video to the player, it’s the reason why it doesn’t work.

That would be very strange. I don’t see any spikes or high usage of RAM, disk I/O or network. But maybe I will run some more tests.
Here is the Peertube Nginx config file: /etc/nginx/sites-enabled/peertube - Pastebin.com

You configuration is broken. Please update it according to the template: https://raw.githubusercontent.com/Chocobozzz/PeerTube/v5.0.0/support/nginx/peertube

Thanks @Chocobozzz, I will look into it soon :+1:

Problem fixed, and while at it, upgraded to version 5.0.1. :sunglasses: