File size upload in nginx.conf
How to increase or decrease the file size upload in Nginx web server using nginx.conf
By default, Nginx web server has a default upload limit of 1MB for files.
To increase or decrease this limit you need to change the
client_max_body_size
parameter in the
nginx.conf
configuration file.
Increase file size upload in nginx.conf
Prerequisites
- Root access to the web server to update the
nginx.conf
file.
Instructions
Log into your web server via SSH.
Edit the
nginx.conf
file:vi /etc/nginx/nginx.conf
Find the
client_max_body_size
parameter. It should be in theserver {}
block directive:server { client_max_body_size 8M; # 8M is 8Mb # other lines }
Replace
8M
with the maximum file limit you want to set.Save the
nginx.conf
file.Reload the configuration file to test it:
sudo nginx -t
Restart Nginx:
sudo systemctl restart nginx