Skip to content

Docker Composer+Google Drive安装付费版著名图床chevereto无限容量

历史缘由

一直听说Chevereto的名字,前段时间趁5折买了个Network License

安装

安装docker composer

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

路径配置

vi docker-compose.yaml
mkdir -p /data/chevereto && cd /data/chevereto

### 以下二选一
mkdir -p chevereto_html/images
### 
# 有个很牛的技巧,试验过了,速度也不错
# 可以直接将images目录软连接到你的Google Drive无限云盘的目录
# 这样就可以有无限存储空间了
ln -s /data/gd_stanford/_psn_gd_stanford/_chevereto_images chevereto_html/images
###

# download installer script - 安装付费版必须 - 不然默认的docker是免费版的
curl https://chevereto.com/download/file/installer >> ./chevereto_html/index.php
# 让目录可写
chown -R www-data:www-data chevereto_html
chmod 755 -R chevereto_html

提高默认的图片上传限制从2M到100M

vi ./chevereto_html/.htaccess
# 在 </IfModule>  *上面*
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value memory_limit 1G
php_value max_execution_time 300
php_value max_input_time 300

反向代理的一些准备

传入真实Real Ip

cat >> ./chevereto_html/app/settings.php <<EOF

// Copy and paste below to end of settings.php will enable to show real ip.
// Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  $http_x_headers = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
  $_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
}

EOF

在宝塔的反代配置文件里加入这么一段

        proxy_set_header  X-Forwarded-Ssl     on;
        proxy_set_header  X-Forwarded-Proto   $scheme;
        proxy_set_header  X-Frame-Options     SAMEORIGIN;
 
        client_max_body_size        100m;
        client_body_buffer_size     128k;

        proxy_buffer_size           4k;
        proxy_buffers               4 32k;
        proxy_busy_buffers_size     64k;
        proxy_temp_file_write_size  64k;

建立docker-composer.yaml

vi docker-compose.yaml
version: '3'
services:
  db:
    container_name: chevereto-mysql
    image: mariadb
    volumes:
      - database:/var/lib/mysql:rw
    restart: always
    networks:
      - private
    environment:
      MYSQL_ROOT_PASSWORD: chevereto_root
      MYSQL_DATABASE: chevereto
      MYSQL_USER: chevereto1
      # change to your own password
      MYSQL_PASSWORD: chevereto1

  chevereto:
    container_name: chevereto-web
    depends_on:
      - db
    # must use installer tag for paid version
    image: nmtan/chevereto:installer
    restart: always
    networks:
      - private
    environment:
      CHEVERETO_DB_HOST: db
      CHEVERETO_DB_USERNAME: chevereto1
      # change to your own password
      CHEVERETO_DB_PASSWORD: chevereto1
      CHEVERETO_DB_NAME: chevereto
      CHEVERETO_DB_PREFIX: chv_
    volumes:
      - ./chevereto_html:/var/www/html:rw
      - ./chevereto_html/images:/var/www/html/images:rw
    ports:
      # change to your own port
      - 8880:80
networks:
  private:
volumes:
  database:

开启docker-compose

# 在/data/chevereto 目录下
# 重启后会自动启动
docker-compose up -d

Web配置

除了数据库配置这里注意点,其他都很容易填。

我中间碰上了这个页面,一直死在这,但重新刷新了页面就好了

然后就结束了

还要再去这里设置一下图片上传的尺寸限制 – https://YourDomain.com/dashboard/settings/image-upload

高级玩法 – 打开CDN

如果嫌慢(毕竟存储用的是Google Drive),可以加CDN (使用免费GCore CDN参考本馆档案

可以参考官方指南 – https://chevereto.com/docs/cdn

GCore CDN
CloudFlare

去 https://cp-public-name.10244201.xyz/dashboard/settings/external-services

之后所有的图片上传之后,给出的链接自动就是

一些参考文献:

Leave a Reply

Your email address will not be published.