群晖7.X安装Chevereto-v3图床

提前准备

  1. Chevereto安装包 【本文发布时Chevereto使用版本为 3.20.18】
  2. 7.X系统的群晖一台
  3. WebStation 【群晖套件】
  4. Apache 2.4 【群晖套件】
  5. PHP 7.4 【群晖套件】
  6. MariaDB 10 【群晖套件】
  7. PhpMyAdmin【群晖套件】

安装

1、 将安装文件上传到群晖想放入的目录中

2、 解压好之后大概是这个样子,我这里之前已经安装过一个,我就新建个目录来演示

3、 打开 PhpMyAdmin 为图床创建一个数据库

创建成功左侧会显示你刚刚创建的数据库

4、 打开WebStation 进行相关设置

  • 找到脚本语言设置 -> Php -> 自定义配置文件
  • 找到Php版本为7.4的配置文件打开,如果没有就新增一个
  • 打开后找到扩展名选项,将所有扩展名都勾选并保存

找到左侧的网页服务门户,选择新增

选择虚拟主机

选择基于端口 , 端口的话可以根据自己的实际情况来分配,我这里分配一个10000

选择下一步,接下来,设置图床的跟目录,后端服务选择 Apache 2.4 ,脚本语言配置勾选Php,选择php7.4的配置

点击新增就算设置完成了

这里会有个弹窗,确定就可以了

这里会多一个你刚刚设置好端口的虚拟主机了。可以通过浏览器来访问这个网站了。

访问地址就是你的 http://你的ip:端口号

5、 安装图床

刚开始访问图床程序会报错如下

Chevereto can't create the app/settings.php file. You must manually create this file.

这是因为图床程序没有目录的写入权限
右键你的目录- 属性 - 权限 打开页面你会发现 http 用户只有读取的权限,这里手动给这个用户分配读写权限

分配好了权限之后,刷新页面

如果出现这个页面,证明你已经离成功很近了

这里设置数据库的时候会有个问题,找不到你的数据库,需要启用MariaDB 的TPC/IP连接

填入下面信息然后 点击 Continue

Database host :localhost:3306/run/mysqld/mysqld10.sock

Database name : 你创建的那个数据库的名字

Database user : root

Database user password : 你的数据库密码

Database table prefix : 数据库字段的前缀,如果你的软件使用的独立数据库可以默认

弹出下面的页面证明你已经安装完成了

点击admin dashboard 输入你的账号密码,就可以进入管理员后台了

设置

1、 首先设置语言

点击右上角你的用户名,选择Settings

找到Language 设置为 简体中文,点击 Save changes

到这里就全部设置好了

跨域问题

找到下面这个文件,下载下来,在自己电脑上把里面的内容都删掉,换成我下面贴的,在上传覆盖你的原文件。重启你的web服务就可以了。

.htaccess

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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]

Header set Access-Control-Allow-Origin "*"

</IfModule>

图床的配置文件路径

跟目录 - app - settings.php

刚刚配置的数据库信息路径等都在这里