Upgrade clarification 4.2.2 to 5.0.1

I’m going to try and upgrade again from 4.2.2 to 5.0.1
When the instructions say "You must update your nginx configuration:
We introduced a new location for plugin websocket routes: does that mean we add

Plugin websocket routes

location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ {
try_files /dev/null @api_websocket;

to our existing nginx config file located at /etc/nginx/sites-available/peertube

Same thing for We introduced a new location for private videos files:
|location ~ ^(/static/(webseed|streaming-playlists)/private/)|^/download {

Thanks Keith

Hi Keith, I was struggling with the same. Eventually what I did is use the entire example config file for version 5.0.x (https://raw.githubusercontent.com/Chocobozzz/PeerTube/v5.0.0/support/nginx/peertube) as a template.
Make a copy of this and put it side to side with yours. I recommend using Notepad++.

Basically copy your specific config sections to this new file, save it and copy it over your existing file (overwriting it). Worked perfectly for me! Of course, make a backup first to you can always go back.

Hi.

The changelog says you need to add the whole [location](https://nginx.org/en/docs/http/ngx_http_core_module.html#location) block indicated. The link in the changelog shows the exact location block you need to copy, so yes, you will need to add this block:

  # Plugin websocket routes
  location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ {
    try_files /dev/null @api_websocket;
  }

and this one:

  location ~ ^(/static/(webseed|streaming-playlists)/private/)|^/download {
    # We can't rate limit a try_files directive, so we need to duplicate @api

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host            $host;
    proxy_set_header X-Real-IP       $remote_addr;

    proxy_limit_rate 5M;

    proxy_pass http://backend;
  }

If you are not familiar with what locations block are in Nginx, I recommend you to read the Nginx documentation: Module ngx_http_core_module

When they are configuration modifications, you can use the diff command to see the différence, as it is said in the documentation

cd /var/www/peertube/versions

diff -u "$(ls --sort=t | head -2 | tail -1)/config/production.yaml.example" "$(ls --sort=t | head -1)/config/production.yaml.example"

diff -u "$(ls --sort=t | head -2 | tail -1)/support/nginx/peertube" "$(ls --sort=t | head -1)/support/nginx/peertube"

diff -u "$(ls --sort=t | head -2 | tail -1)/support/systemd/peertube.service" "$(ls --sort=t | head -1)/support/systemd/peertube.service"

Ok found the peertube-v5.0.1/Support/nginx file where is my current nginx file located at to compare of just copy the new one to

PLEASE disreguard looks like I am up

HOWEVER you might make a note that redis may need to be upgraded to something greater then 4.0.9

Thanks