Nginx config and upload limit

Hi! I know there is plenty of doc and answers about this subject but I tried a lot of things yet and I have the feeling I am missing something.

Since the last peertube upgrade, my peertube instance stops uploads with “Your video file was too large (max. size: 2M)”. I am trying to remove this limitation.

My first problem is that I have many config files:

  • /etc/nginx/sites-enabled/
  • /etc/nginx/nginx.conf
  • /var/www/peertube/versions/peertube-v4.1.1/support/nginx/peertube

What file should I modify?

My second problem is, what should I modify exactly.
Is that client_max_body_size in http{}, serve{} or location /upload{}?

Thank you for your help.

The file you have to modify is /etc/nginx/sites-enabled/

It should be the same as /var/www/peertube/versions/peertube-v4.1.1/support/nginx/peertube, where you replace ${WEBSERVER_HOST} by your server hostname (, and ${PEERTUBE_HOST} by (assuming peertube is listening locally on 9000 port, which is the default).

In the installation documentation:

This is achieved by these commands:

sudo cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube
#Then set the domain for the webserver configuration file. Replace [peertube-domain] with the domain for the peertube server.
sudo sed -i 's/${WEBSERVER_HOST}/[peertube-domain]/g' /etc/nginx/sites-available/peertube
sudo sed -i 's/${PEERTUBE_HOST}/' /etc/nginx/sites-available/peertube

The first command copy the file, and sed is a «search and replace tool».

If you think that your nginx file is not correct, you can make these steps again (backup your file before, just in case). Don’t forget to replace [peertube-domain] by