1.上传文件提示413 Request Entity Too Large错误
如果是用了nginx作为web服务器,并且上传的文件比较大时,需要修改nginx的最大上传限制。
1.修改 client_max_body_size 2000m;//#最大限制为2000M,
2.重启nginx(service nginx restart)
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_max_body_size 2000m;//#最大限制为2000M
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
2.您想要上传的文件可能太大了
1.修改/etc/php.ini upload_max_filesize、memory_limit、post_max_size 根据自己需求修改,
2.重启PHP(sudo service php-fpm restart)
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
;upload_max_filesize = 2M
upload_max_filesize = 300M
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
;memory_limit = 128M
memory_limit = 300M
; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
;post_max_size = 8M
post_max_size = 300M