I have faced an error 413 request entity too large on NGINX while configuration for my application, finally found the solution to fix this issue, you simply need to add client_max_body_size to BOTH the HTTP server block and the HTTPS server block
Lets be aware that browsers cannot correctly disaply an error on the console window.
STEP1 : Open the terminal for Ubuntu:
sudo vim /etc/nginx/site-available/
STEP2: Edit the file:
set client body size to 100M:
client_max_body_size 100M;
need to add client_max_body_size to BOTH the HTTP server block and the HTTPS server block, as shown in the example below:
http {
# HTTP server
server {
listen 80;
server_name example.com;
client_max_body_size 100M;
}
# HTTPS server
server {
listen 443 default_server ssl;
server_name example.com;
client_max_body_size 100M;
}
}
# HTTP server
server {
listen 80;
server_name example.com;
client_max_body_size 100M;
}
# HTTPS server
server {
listen 443 default_server ssl;
server_name example.com;
client_max_body_size 100M;
}
}
Syntax: client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, location
Comments (0)