Springboot项目修改文件传输(minio)限制大小

 

nginx 配置文件

http {

# 设置文件传输大小
client_max_body_size 2048M;

# 其他配置==========================================
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}

 


springboot 项目配置文件
nginx 配置完重启之后,发现并没有起作用,后来想到可能是 springboot 的原因,因此这里修改项目的配置文件。

springboot 修改文件传输大小限制,直接在 yml 配置文件修改即可,笔者这里改成 2G。

spring:
servlet:
multipart:
# 设置传输大小
max-file-size: 2048MB
max-request-size: 2048MB

经过这两处配置修改,最终可以正常上传 2G 以内大小的文件。

原文链接:https://blog.csdn.net/linzi19900517/article/details/125992050

posted on 2023-06-08 16:39  A欣  阅读(1245)  评论(0)    收藏  举报

导航