Solution to the Request Entity Too Large problem in CENTOS reverse proxy nginx

Phenomenon: When uploading an image with more than 3M on the webpage, a prompt of Request Entity Too Large appears, as shown in the figure below


Judging from experience, the upload file size should be limited. I checked the application configuration is 10M, set it to 100M, restarting the service will not solve the problem.
It turns out that our tomcat discovers the service agent through nginx, and the problem occurs on the nginx server. The original nginx default long-transfer file size is 1M, which can be modified in the nginx configuration.
Solution:
1. Open the configuration file nginx.conf of the nginx service, the path is generally: /usr/local/nginx/conf/nginx.conf.
2. Add client_max_body_size 100m to http{}, and I configure 100M here.
http {

client_max_body_size 100m;
    include       mime.types;
    default_type  application/octet-stream;


3. Re-service nginx.

# /usr/local/nginx/sbin/
# ./nginx -v

# ./nginx -s stop
# ./nginx

Guess you like

Origin blog.csdn.net/kakak2000/article/details/105859068