An error occurred when sending a request: 413 Request Entity Too Large

question

An error occurred when sending a post request:

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.23.2</center>
</body>
</html>

reason

nginx has a client request body size limit, the default is: 1M, and the size of the uploaded file in the POST request I sent was 9M, so it was intercepted by nginx and an error was reported: 413 Request Entity Too Large

nginx limitation description:
Insert image description here

solve

Modify nginx.confthe configuration and add it to the interface proxy . You can set the value larger client_max_body_size 100M;according to your needs . client_max_body_size Finally, just restart nginxthe service.

# nginx.conf
user root;
worker_processes 1;
events {
  worker_connections 1024;
}
http {
  include mime.types;
  server {
    listen 80;
    server_name your.domain.com;
    root /usr/share/nginx/files;
    charset utf-8;
    location / {
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        client_max_body_size 100M;
    }
  }
}

Guess you like

Origin blog.csdn.net/weixin_42492572/article/details/131531056