解决nginx和php使用ckfinder无法上传大文件的问题

现象描述:

cms内容发布系统上传不了大文件,当上传超过32M文件时就上传不了

 

提示:无效的文件. 文件尺寸太大。

 

 

分析文件上传过程:

browser --> nginx --> php  

 

 

需要修改 nginx.conf和php.ini

1.nginx.conf新增如下参数,重启无效:

client_max_body_size 512M;
client_body_buffer_size 128M;

  

 

2.修改php.ini配置,重启php-fpm无效:

/usr/local/php-7.0.12_fpm/lib/php.ini

post_max_size = 512M
upload_max_filesize = 256M

  

资源网站大全 https://55wd.com 我的007办公资源网站 https://www.wode007.com

3.找到上传文件代码所在的目录 /data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public

[root@newcms:/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public]# grep -ri "无效的文件. 文件尺寸太大"
resources/js/libs/ckfinder/core/connector/php/lang/zh-cn.php:	‘203‘ => ‘无效的文件. 文件尺寸太大。‘,
resources/js/libs/ckfinder/lang/zh-cn.js:	203 : ‘无效的文件. 文件尺寸太大。‘,

  

 

发现使用了 ckfinder 这个富文本插件


经过搜索发现限制在配置文件config.php,修改最大文件问题解决:

[root@newcms:/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public]# find ./ -name config.php
/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public/resources/js/libs/ckfinder/config.php

$config[‘DefaultResourceTypes‘] = ‘‘;

$dir_name_1 = preg_replace(‘/.+\/([^\/]*[a-z]+\.[a-z]+)\/.+/‘, ‘$1‘, $baseDir);
$config[‘ResourceType‘][] = Array(
‘name‘ => $dir_name_1, // Single quotes not allowed
‘url‘ => $baseUrl,
‘directory‘ => $baseDir,
‘maxSize‘ => "300M",	# 修改此处
‘allowedExtensions‘ => isset( $_GET[‘show_format‘] ) ? $_GET[‘show_format‘] : ‘‘,
‘deniedExtensions‘ => ‘‘);

$config[‘AccessControl‘][] = Array(
‘role‘ => ‘*‘,
‘resourceType‘ => $dir_name_1,
‘folder‘ => ‘/‘,

‘folderView‘ => true,
‘folderCreate‘ => true,
‘folderRename‘ => false,
‘folderDelete‘ => true,

‘fileView‘ => true,
‘fileUpload‘ => true,
‘fileRename‘ => true,
‘fileDelete‘ => true);


$dir_name_2 = ‘All files list‘;
$config[‘ResourceType‘][] = Array(
‘name‘ => $dir_name_2,
‘url‘ => ‘‘,
‘directory‘ => ‘‘,
‘maxSize‘ => "300M", # 修改此处
‘allowedExtensions‘ => isset( $_GET[‘show_format‘] ) ? $_GET[‘show_format‘] : ‘‘,
‘deniedExtensions‘ => ‘‘);

  

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值