惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
M
MIT News - Artificial intelligence
D
Docker
量子位
T
Tailwind CSS Blog
人人都是产品经理
人人都是产品经理
月光博客
月光博客
有赞技术团队
有赞技术团队
J
Java Code Geeks
A
About on SuperTechFans
P
Proofpoint News Feed
Jina AI
Jina AI
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
GbyAI
GbyAI
F
Fortinet All Blogs

Allen Hua 的网络博客

由于 Linux 桌面没有一个好用的天气程序就写了一个跨平台的CheckitoutWeather 给 caesium-image-compressor 图片压缩程序构建了 Linux AppImage v2.8.5 最新版 debian13(debian trixie)安装了nvidia闭源驱动后从x11切换到wayland的方法 山间摩旅追风,偶遇一场绚烂晚霞 最近使用debian系统的一些心得 机械革命无界14Pro笔记本debian forky成功驱动内置扬声器和麦克风 记录 typecho 1.2.0 升级到 1.3.0 过程 开发了一款openwrt插件:文本剪贴板 解决机械革命笔记本内屏高刷240Hz闪屏问题 使用 Java 写了一个局域网端口扫描器 - Allen Hua 的网络博客 openwrt使用外置根extroot机制扩展根分区大小 - Allen Hua 的网络博客 将机场ss节点批量转换成ss字符串链接批量添加到passwall - Allen Hua 的网络博客 给机械革命钛钽plus换屏:NY2换成NZ2 - Allen Hua 的网络博客 记录一次pve宿主机和上面的debian虚机无故down机事件 - Allen Hua 的网络博客 给图床部署cdn腾讯云的edgeone并排查Cache-Control max-age 3600的问题 - Allen Hua 的网络博客 从高山草甸到徽派古村:武功山反穿与皖浙赣自驾行记 - Allen Hua 的网络博客 增程器就是充电宝?别被忽悠了 - Allen Hua 的网络博客 浦口龙虎巷扫街,记录人间真实 博客图片压缩方案更新|AVIF|WebP|MozJPEG|标准JPEG Windows 电脑使用 Obs Studio 录制各个网站视频/桌面画面教程 为typecho博客添加latex支持 新能源汽车之纯电车使用交流慢充和直流快充的充电损耗对比 2025年3月更新全国5A景区名录 2025最新查看小米/红米手机电池健康度和循环次数方法 完美解决 seafile FILE_SERVER_ROOT 配置导致的内网外网不能同时访问和上传下载的问题 纯css实现typecho博客文章文字spoiler剧透效果 我对Typecho Facile主题的一些修改,图片懒加载优化,样式定制 2024年8月我的宜昌 - 重庆 - 川西小环线自驾旅行分享 2022年打卡南京市区人防工程纳凉点 2024年带着A7C2+腾龙28-200 再次来到红山森林动物园
vps 上通过 docker compose 安装 chevereto 图床服务并配置 n...
Allen Hua · 2021-07-30 · via Allen Hua 的网络博客
阅读量:5034

warning: 这篇文章距离上次修改已过1609天,其中的内容可能已经有所变动。

docker-compose.yml (path is: /docker/docker-compose/chevereto/docker-compose.yml)

参考安装教程:使用 Docker 安装 Chevereto https://juejin.cn/post/6857029114718355463

version: '3'

services:
  db:
    image: mariadb
    container_name: chevereto-mysql
    # 挂载容器中的mysql数据卷到本地database文件夹
    volumes:
      - ./database:/var/lib/mysql:rw
    restart: always
    networks:
      - chevereto-net
    # 设置容器中的mysql的root用户密码以及其他用户
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_DATABASE: chevereto
      MYSQL_USER: chevereto
      MYSQL_PASSWORD: chevereto
    ports:
     - 3306:3306

  chevereto:
    depends_on:
      - db
    image: nmtan/chevereto
    container_name: chevereto
    restart: always
    networks:
      - chevereto-net
    # 设置CHEVERETO_DB的一些参数
    environment:
      CHEVERETO_DB_HOST: db
      CHEVERETO_DB_USERNAME: chevereto
      CHEVERETO_DB_PASSWORD: chevereto
      CHEVERETO_DB_NAME: chevereto
      CHEVERETO_DB_PREFIX: chv_
    # 挂载容器中的images文件夹到本地的chevereto_images文件夹
    volumes:
      - ./chevereto_images:/var/www/html/images:rw
    # 端口映射,本机:容器,需要配置安全组
    ports:
      - 8082:80
networks:
  chevereto-net:
volumes:
  database:
  chevereto_images:

修改图片上传的大小限制

默认的是上传单个文件最大大小是 2MB,游客 0.5MB,最大的执行大小 8MB。下面是解决方法

在容器中该目录下 /usr/local/etc/php new 一个文件,名字叫 php.ini,写上以下文本。在该目录下还有文件 php.ini-developmentphp.ini-production、和conf.d 这个文件夹

[PHP]
max_execution_time = 60;
memory_limit = 256M;
upload_max_filesize = 256M;
post_max_size = 256M;

然后重启 chevereto 容器

问题解决了

image.png


另外之前通过 frp 做的家里 t400 上的 chevereto 图床服务每次生成的链接 url 里都带上了端口 :443 这个问题,今天终于解决了。

justhost.ru 机器上通过 docker 安装了 chevereto 也遇到了这个问题。通过 nginx 反代。

产生这个问题的原因:由于 location / 块里设置反代的 header 主机带上了端口导致的此问题。

proxy_set_header Host $host:$server_port;

上面这一行改成下面这样就 OK 了

proxy_set_header Host $host;

贴一个完整配置

server {
        listen       80;
        server_name  img.hellodk.com;
        server_tokens off;
        return 301 https://$host$request_uri;

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
}

server
{
    listen 443 ssl http2;
    port_in_redirect off;
    server_name img.hellodk.com;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_ssl_server_name on;
    server_tokens off;
    ssl_certificate    /etc/letsencrypt/live/hellodk.com/fullchain.pem;
    ssl_certificate_key    /etc/letsencrypt/live/hellodk.com/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_timeout 10m;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

    error_page 404 /404.html;
    error_page 502 /502.html;

    #PHP-INFO-START  PHP引用配置,可以注释或修改
    #SECURITY-START 防盗链配置
    #SECURITY-END
    #include enable-php-71.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    #include /www/server/panel/vhost/rewrite/hellodk.cn.conf;
    #REWRITE-END

    location / {
         proxy_pass         http://127.0.0.1:8082;
         proxy_set_header   Host $host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_read_timeout  1200s;
         proxy_ssl_server_name on;
         proxy_set_header X-Forwarded-Proto $scheme;

         # used for view/edit office file via Office Online Server
         client_max_body_size 64m;
    }

    access_log      /var/log/nginx/chevereto-current-host.access.log;
    error_log       /var/log/nginx/chevereto-current-host.error.log;
}

end.