我昨天启动了一个早期测试版网站.是vrep.io,我遇到了一个奇怪的问题.当上传大于2mb的图像(用户头像)时,laravel验证程序会返回“ validation.uploaded”错误消息.
验证码:
protected function basicValidator( array $data ) {
return Validator::make( $data,[
'name' => 'required|min:2|max:255','occupation' => 'max:255','avatar' => 'mimes:jpeg,png,gif|dimensions:min_width=500,min_height=500|max:8000','drop-avatar' => 'in:1,0',],[
'avatar.mimes' => 'Uploaded file format should be jpeg,jpg,png or gif.','avatar.dimensions' => 'Image should have minimum 500x500px dimensions.','avatar.max' => 'Maximum allowed file size is 6 MB.',] );
}
upload_max_filesize 100M
post_max_size 100M
memory_limit 256M
它在AWS EC2实例上运行. UBUNTU 16.04和Nginx.
$sudo vim /etc/Nginx/sites-available/default
client_max_body_size 100m;
重新启动Nginx和PHP,甚至重新启动整个Web服务器.没有效果.上载大于2mb的文件时仍然出现相同的错误.
ps.我在本地运行homestead,文件上传工作正常.问题仅在生产服务器上.
我在那里想念什么?
最佳答案
原文链接:https://www.f2er.com/nginx/532326.html