图床是什么?为什么需要图床?
假设你在微博分享一张图片,你的粉丝可以通过互联网看到你分享的图片,那么他是去访问你的手机的相册吗?其实不是的,你分享图片,也就是把图片上传到微博的服务器,微博将为你生成一个独一无二的访问链接,这个链接指向的空间其实就是图床。
提取码
图床展示
![图片[1]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/cheveretotcdjjc.png)
![图片[2]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/cheveretotcdjjc1.png)
![图片[3]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/cheveretotcdjjc2.png)
![图片[4]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/cheveretotcdjjc3.png)
安装教程
1.在成功下载Chevereto安装文件后,上传并解压到网站根目录
2.安装php扩展,Exif和fileinfo扩展
3.在网站配置文件中添加如下代码
location /
{
try_files $uri $uri/ /index.php?$query_string;
}
![图片[5]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/tcpzwj.jpg)
4.新建数据库
![图片[6]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/tcmariradb.png)
5.填写相关设置并确认安装
![图片[7]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/tcinstall.png)
![图片[8]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/tcinstall1.png)
点击Install Chevereto完成安装
升级教程
1.正常情况是可以通过一键自动升级的。
![图片[9]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/chevereto.upload1.jpg)
但是也有不正常的情况,自动升级失败,可能是被墙了的原因
![图片[10]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/chevereto.upload2.jpg)
不管是自动更新还是手动更新,更新前一定做好备份!!!
![图片[11]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/chevereto.upload4.jpg)
下载最新文件并解压,解压覆盖当前旧版本文件。(我使用nas搭建的图床,所以直接就能修改文件内容,如果使用的vps可以使用FTP。)
![图片[12]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/chevereto.upload6.jpg)
覆盖旧文件后浏览器打开图床地址,更新数据库,即可更新成功。
![图片[13]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/chevereto.upload3.jpg)
还有一种办法就是,备份setting.php文件和images文件夹。
1.复制配置文件
cp /etc/nginx/html/chevereto/app/settings.php /etc/nginx/html/Chevereto-New/app/
2.复制图片
cp -r /etc/nginx/html/chevereto/images/* /etc/nginx/html/Chevereto-New/images/
3.重命名目录
mv ./chevereto/ ./chevereto_bak
mv ./Chevereto-New/ ./chevereto
安装迁移问题及解决办法
使用Nginx404错误解决办法
我在帮别人搭建的第一步就出现了404错误,不管怎么操作都不能弹出安装界面,一直提示404错误。发现原来是因为我采用的Nginx的关系,只要填写一下伪静态Rewrite规则就可以了。
![图片[14]-chevereto图床搭建及更新教程-阿张同学](https://www.cnnc404.com/wp-content/uploads/chevereto1.png)
Nginx URL rewriting规则
# Context limits
client_max_body_size 20M;
# 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;
}
Apache HTTP Server URL rewriting规则
<Directory /var/www/html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
Apache虚拟主机 .htaccess
(在网站根目录/)
# Disable server signature
ServerSignature Off
# Enable CORS across all your subdomains (replace dev\.local with your domain\.com)
# SetEnvIf Origin ^(https?://.+\.dev\.local(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
# Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN
# Header merge Vary "Origin"
# Disable directory listing (-indexes), Multiviews (-MultiViews)
Options -Indexes
Options -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
# If you have problems with the rewrite rules remove the "#" from the following RewriteBase line
# You will also have to change the path to reflect the path to your Chevereto installation
# If you are using alias is most likely that you will need this.
#RewriteBase /
# 404 images
# If you want to have your own fancy "image not found" image remove the "#" from RewriteCond and RewriteRule lines
# Make sure to apply the correct paths to reflect your current installation
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule images/.+\.(gif|jpe?g|png|bmp|webp) - [NC,L,R=404]
#RewriteRule images/.+\.(gif|jpe?g|a?png|bmp|webp) content/images/system/default/404.gif [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpe?g|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|webp|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
RewriteRule . index.php [L]
</IfModule>
以上代码适用于Chevereto 3.x
- 最新
- 最热
只看作者