nginx Apache IIS server resolve 413 Request Entity Too Large problem method summary

  • 2020-05-07 20:50:44
  • OfStack

1. nginx server

The problem with nginx is that the request entity is too long. 1 it usually happens that Post requests Body content Post's data is too large,
For example, large files are uploaded and POST data is too large.

Processing method

Add client_max_body_size to nginx.conf, this value is 1m by default, can be increased to 8m to increase the file size limit; Of course you can make it bigger.


#  in http . server or location Segment modify the following configuration: 
# set client body size to 8M #
client_max_body_size 8M;


2. Apache server

Modify the LimitRequestBody configuration in the Apache configuration file. If it is a virtual host, please contact the space provider to help modify it.

Specific steps:
When uploading large software in apache environment, sometimes there will be a 413 error. The reason for this error is due to the improper configuration of apache. Find the configuration file directory of apache, which is conf directory
The contents of the catalogue are as follows:

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php4_module modules/libphp4.so
#
# Cause the PHP interpreter handle files with a .php extension.
#
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 6550000
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

The error is in the LimitRequestBody configuration, which you can change to larger than the size of your software

If you do not have this configuration file, please send

SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 6550000

Write to the apache configuration file.

3. IIS server (Windows Server 2003 system IIS6)

Stop the IIS Admin Service service, and then
Find metabase.xml under windows\system32\inesrv\, open, find ASPMaxRequestEntityAllowed modified to the desired value, and then restart the IIS Admin Service service

1. The web service extension allows active server pages and includes documents on the server side
2, modify the properties of each site home directory - configuration - options - to enable the parent path
3. Make it possible to upload large documents (just change them to the size you want, in bytes)
c:\WINDOWS\system32\inetsrv\MetaBase.xml

! windows2003 for enterprise is at line 592
The default preset value AspMaxRequestEntityAllowed="204800" is 200K

Add two zeros to it, and you can now upload 20M.

AspMaxRequestEntityAllowed="20480000"


Related articles: