配置环境:
- LNMP with Ubuntu 18.04
- VPS 内存 1024MB
- PHP 版本 7.2
- Chevereto 版本 1.3.0
/etc/php/7.2/fpm/conf.d/chevereto.ini
文件的配置如下:
upload_max_filesize = 64M;
post_max_size = 64M;
max_execution_time = 120;
memory_limit = 1024M;
/etc/nginx/sites-available/image.prosanto.me.conf
文件配置如下,并且已经创建 /etc/nginx/sites-enabled/
的软连接:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name image.prosanto.me;
root /var/www/html/chevereto;
index index.html;
# Context limits
client_max_body_size 64M;
# Disable access to sensitive files
location ~* (app|content|lib)/.*\.(po|php|lock|sql)$ {
deny all;
}
# Image not found replacement
location ~ \.(jpe?g|png|gif|webp)$ {
log_not_found off;
error_page 404 /content/images/system/default/404.gif;
}
# CORS header (avoids font rendering issues)
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
}
# Pretty URLs
location / {
index index.php;
try_files $uri $uri/ /index.php$is_args$query_string;
}
location ~* \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
并且已经重启过 PHP 和 Nginx:
systemctl restart php7.2-fpm
systemctl restart nginx
Chevereto 仪表盘截图(未见问题):
Chevereto 首页截图(问题所在,此时用户以管理员身份已登录):
上传图片时的报错(从仪表盘上传和已管理员用户身份上传报错信息一致):
Chevereto图床后台显示的参数是修改了,前台上传还是没有变化,这是为什么呢?其实很简单,那就是Chevereto图床设置中没有设置好最大上传大小和最大执行大小!
修改了
PHP.INI
参数后,前往Chevereto图床管理员后台,设置-网站-图片上传中修改最大文件大小 (MB) [MB],这样我们才能成功修改Chevereto图床的文件上传大小!两个步骤缺一不可!另外技术宅友情提醒下,如果图片上传尺寸过大,服务器上传不给力的话还需要修改下最大可执行时间