Nginx 413 Request Entity Too Large

413 Request Entity Too Large Nginx failed to upload a file

The problem to show

Is also familiar step pit link 😂! Take a look at what emirates stumbled into today:

Tried to upload file to server, encountered big:

why

Nginx’s default file upload size is larger than the size of the files you upload

The solution

Find the nginx configuration file

Find the nginx configuration file (nginx/conf/nginx.conf)

Modify theserverthelocationThe configuration of the

Find the server you want to modify, for example:

server { listen 80; server_name adb.abc.com; location / { root html; index index.html index.htm; }}Copy the code

Add a line of configuration to the Location block:

client_max_body_size  64m; # Change to the size you need!
Copy the code

After modification, it becomes:

    server {
        listen 80;
        server_name adb.abc.com;
        location / {
            root   html;
            index  index.html index.htm;
            client_max_body_size  64m; # Change to the size you need!}}Copy the code

Save and restart

Save the file and restart nginx(replace the first nginx with the directory you installed):

nginx/sbin/nginx -s reload
Copy the code

Attached with official documents

If the above solution does not solve your problem, you can also check the official Nginx Chinese documentation

conclusion

If you have any questions, objections or suggestions for improvement, please feel free to comment below. The author will reply asap! For the latest articles, please read the official blog.

For more and better tutorials/blogs/information, please visit my official website: Emirates Technical website.