nginx 413 request too large

How to Fix NGINX 413 Request Too Large Error

If you try to upload a large file to NGINX server, it may give “413 : Request Entity Too Large” error. In this article, we will look at how to fix NGINX 413 request too large error for your website.


What is 413 : Request Too Large Error? Why do you get it?

By default, NGINX supports uploads of up to 2Mb. This setting is controlled by client_max_body_size parameter. If the uploaded file exceeds this size, then you get “Request Entity Too Large” error response.


How to Fix NGINX 413 Request Too Large Error

Here are the steps to fix NGINX 413 Request Too Large Error. We will basically modify the client_max_body_size server parameter to handle a larger request size.


1. Open NGINX Configuration File

Open terminal and run the following command to open NGINX configuration file.

$ sudo vi /etc/nginx/nginx.conf

Also Read : How to Remove WWW from Domain URL in NGINX


2. Increase Request Size Limit

Add modify the client_max_body_size parameter in your server configuration file. Below we have increased the client_max_body_size directive to 10Mb size.

client_max_body_size 10M;

You can change it as per your requirement.

Also Read : How to Redirect HTTP to HTTPS in NGINX


3. Restart NGINX Server

Run the following command to check syntax of your updated config file.

$ sudo nginx -t

If there are no errors, run the following command to restart NGINX server.

$ sudo service nginx reload #debian/ubuntu
$ systemctl restart nginx #redhat/centos

Hopefully, this article will help you redirect WWW to Non-WWW URLs in NGINX. Ubiq makes it easy to visualize data, and monitor them in real-time dashboards. Try Ubiq for free.

mm

About Ubiq

Ubiq is a powerful dashboard & reporting platform for small & medium businesses. Build dashboards, charts & reports for your business in minutes. Get insights from data quickly. Try it for free today!