Springboot项目部署之文件上传报错413 Request Entity Too Large错误

在项目部署的时候,遇到一个问题, 就是上传文件的时候报错 http 请求报 413 Request Entity Too Large错误。
后来发先是nginx中未设置 请求体大小。

server {
                listen       80;
                server_name  localhost;
                charset utf-8;
		# nginx 配置客户端请求体最大值多少M
                client_max_body_size 5M;

                location / {
                        root   /home/record/lb-project/lb-vue;
                        try_files $uri $uri/ /index.html;
                        index  index.html index.htm;
                 }

                location /admin/ {
                        root   /home/record/lb-project/lb-admin-vue;
                        try_files $uri $uri/ /index.html;
                        index  index.html index.htm;
                 }

                location /api/{
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header REMOTE-HOST $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_pass http://localhost:9088/;
                }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
                }
 }
原文地址:https://www.cnblogs.com/qianzhengkai/p/15563281.html