群晖Docker安装chevereto图床

/ NAS / 没有评论 / 4975浏览

Docker chevereto 准备的环境

mysql 数据库 (我目前是使用的是MariaDB 10,安装数据库不多做叙述,可以看我之前的教程)

我用的是 Navicat ,新建数据库 填写 chevereto 如图:

https://nas.mrf.ink:10001/images/blog/2020/06/chevereto6.png

Docker chevereto的下载

在群晖docker里面的注册表里面搜索 Chevereto ,我用的nmtan/chevereto下载,如果有让你选择标签的话默认就好,等待容器镜像下载完成。如图: https://nas.mrf.ink:10001/images/blog/2020/06/chevereto1.png

Docker chevereto的存储卷

在群晖的docker目录里面建立子目录Chevereto,后面安装容器会挂载此目录作为图床的文件存储目录,注意文件名的大小写 https://nas.mrf.ink:10001/images/blog/2020/06/chevereto2.png

Docker chevereto的配置

容器镜像下载完成后,点击下载的镜像文件名的小箭头,查看该容器该如何进行配置,docker其实大部分都有配置介绍,多看看自己也会配置 https://nas.mrf.ink:10001/images/blog/2020/06/chevereto3.png

https://nas.mrf.ink:10001/images/blog/2020/06/chevereto4.png

双击该镜像进行安装,容器名称随意填写,内存限制根据实际需要填写,点击高级设置,启用自动重新启动打钩,卷设置里面点击添加文件夹,选择你刚刚在docker目录下创建的 chevereto目录,后面装载路径填写【/var/www/html/images】,不能有空格,请注意,然后在到端口设置,本地端口设置为10000,容器端口不需要修改,后面进行docker的环境配置,

https://nas.mrf.ink:10001/images/blog/2020/06/chevereto5.png

点击启用后,可以使用http:群晖地址:10000 进行访问,设置 相关的信息

有时候会提示群晖 没有 对 images 文件夹的写入权限 ,后面对/volume1/docker/chevereto 赋予权限即可!

也可以从ssh 里面直接赋予所有权限

chmod +r 777 chevereto

Docker chevereto修改上传大小

http://域名:10000/dashboard/settings/image-upload

获取root权限

admin@XiaoMageNAS:~$ sudo -i
root@XiaoMageNAS:~# 

查看运行的docker容器

root@XiaoMageNAS:~# docker ps -a
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                     PORTS                                             NAMES
327c9776e0d3        nmtan/chevereto:latest             "docker-php-entrypoi…"   17 hours ago        Up 5 hours                 0.0.0.0:10000->80/tcp                             Chevereto
7a30c3437280        oldiy/music-player-docker:latest   "docker-php-entrypoi…"   13 days ago         Up 13 days                 0.0.0.0:32769->264/tcp, 0.0.0.0:32768->9000/tcp   oldiy-music-player-docker1
1c8b79caaee6        luodaoyi/kms-server:1112           "/bin/sh -c 'vlmcsdm…"   8 weeks ago         Exited (255) 7 weeks ago                                                     luodaoyi-kms-server1
root@XiaoMageNAS:~# 

复制到群晖本地目录

root@XiaoMageNAS:~# docker cp  327c9776e0d3:/var/www/html/.htaccess /volume1/docker/
root@XiaoMageNAS:~# 

修改配置文件

vi /volume1/docker/.htaccess
# Disable server signature
ServerSignature Off



# Disable directory listing (-indexes), Multiviews (-MultiViews) and enable Follow system links (+FollowSymLinks)
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) - [NC,L,R=404]
    #RewriteRule images/.+\.(gif|jpe?g|png|bmp) 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|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
    RewriteRule . index.php [L]
    #修改上传文件大小增加以下 配置  最大支持 32M 根据自己情况配置
    php_value post_max_size 64M
    php_value upload_max_filesize 32M

</IfModule>

复制到容器目录里面

docker cp /volume1/docker/.htaccess 327c9776e0d3:/var/www/html/

然后进入到docker容器管理里面重新启动即可解除2m上传限制

https://nas.mrf.ink:10001/images/blog/2020/06/chevereto7.png