安装可道云Kodexplorer

可道云Kodexplorer是一个基于web的文件管理器,这里可以查看官方文档

nginx配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 620 default_server;
listen [::]:620 default_server;

root /var/www/kodexplorer;
index index.php
server_name www.redtux.cn;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
# fastcgi_pass 127.0.0.1:9000;
}

location ~ /\.ht {
deny all;
}
}

php库缺失 curl
php库缺失 mb_string
须开启php GD库,否则验证码、缩略图使用将不正常

配置优化

  1. 修改nginx的配置文件
1
2
3
4
5
6
7
8
client_max_body_size 500M;        
client_header_timeout 3600s;
client_body_timeout 3600s;
fastcgi_connect_timeout 3600s;
fastcgi_send_timeout 3600s;
fastcgi_read_timeout 3600s;
# 其他webserver相应修改类似限制;如apache需要修改LimitRequestBody
# 修改完成重启nginx生效: service nginx reload
  1. 修改php配置文件php.ini;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
post_max_size = 500M;
upload_max_filesize = 500M;
memory_limit = 500M;
max_execution_time = 3600;
max_input_time = 3600;

# php中设置set_time_limit无效(safe_mode=on时php代码中修改超时无效) php.ini
safe_mode = off

# php-fpm.conf 配置优化(超时时间; 4G内存推荐如下子进程配置)
request_terminate_timeout 3600
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 30
pm.max_requests = 500
  • 注意:
    • 如果某一类例如exe文件不能上传,其他文件可上传, 一般是服务器(杀毒软件或防火墙)做了拦截误判,取消相应软件上拦截即可;
    • 超时时间设置; 如果经常有超大文件上传,php和nginx超时时间需要设置大一些;
    • 分片上传: 一个大文件切分成多个分片上传,所有片上传完成后服务器自动合并;一个分片上传失败只需要重传该分片即可;
    • 分片大小设置: 管理员登陆后台–基础设置–上传下载; 调整上传分片大小; 必须小于php.ini和nginx的限制;
    • 修改了php或nginx配置文件后,需要重启php-fpm和nginx;
    • 上传文件限制及超时时间可以根据自己需求设置; 超时时间需大于文件上传下载的时间,否则超时会导致操作失败;
  1. 修改可道云配置

设置方法:管理员登陆可道云进入后台 系统设置—基础设置—上传/下载

  • 设置分片大小: 推荐5M

大文件上传时切分成片进行并发上传,从而实现加速和断点续传,
推荐5M; 此值必须小于下述配置;否则会引起上传异常(上传失败,进度回退)
php.ini: post_max_size, upload_max_filesize ==> 5M
nginx: client_max_body_size ==> 5M;

  • 上传并发数量; 推荐15个并发;
  1. nginx + php-fpm上传优化

在nginx.conf中添加如下代码,参考更多nginx优化

1
2
3
4
#使用共享内存做临时存贮提高上传速度,共享内存需要大一些,否则上传大文件内存不足
client_body_in_file_only clean;
client_body_temp_path /dev/shm 1 2;
fastcgi_param REQUEST_BODY_FILE $request_body_file;
作者

redtux

发布于

2023-08-05

更新于

2023-08-05

许可协议

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.