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

推荐订阅源

S
SegmentFault 最新的问题
The Last Watchdog
The Last Watchdog
C
Cisco Blogs
L
LINUX DO - 热门话题
T
Tenable Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cyberwarzone
Cyberwarzone
O
OpenAI News
The Hacker News
The Hacker News
V
Vulnerabilities – Threatpost
A
Arctic Wolf
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
量子位
V2EX - 技术
V2EX - 技术
GbyAI
GbyAI
W
WeLiveSecurity
Recorded Future
Recorded Future
P
Proofpoint News Feed
Project Zero
Project Zero
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
S
Security Affairs
Stack Overflow Blog
Stack Overflow Blog
B
Blog
Y
Y Combinator Blog
月光博客
月光博客
K
Kaspersky official blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Latest news
Latest news
Forbes - Security
Forbes - Security
T
Troy Hunt's Blog
T
The Blog of Author Tim Ferriss
C
Check Point Blog
D
DataBreaches.Net
MyScale Blog
MyScale Blog
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
D
Docker
P
Privacy International News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
Cyber Attacks, Cyber Crime and Cyber Security
S
Securelist
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
SecWiki News
SecWiki News
腾讯CDC
博客园 - Franky

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 再次来到红山森林动物园 入手a7c2第一个变焦镜头腾龙28-200体验分享 使用 exiftool 方便快捷写入图片的 exif metadata 使用JavaScript抓取易车销量排行榜数据到一个页面上展示 使用JavaScript脚本快速获取B站观看历史记录页面的视频标题和URL 入门三脚架推荐|云腾VCT-668配合索尼A7C2+FE 35mm F1.8 第一次夜景出片 Windows 11 Docker Desktop 更换默认C盘存储路径,释放C盘空间 雨游钟山——雨天带着索尼A7C2去钟山拍照 带上A7C2第一次扫街,分享今天拍的一些片子 再次为尼,买了人生第二台相机——索尼A7C2和FE 35mm F1.8 定焦镜头 更新 link-cleaner v1.1.0 适配linux桌面环境 使用自定义JavaScript脚本功能禁止memos最新版默认打开的链接预览功能 debian 11升级 docker ce 版本和 docker-compose 版本 机械革命无界14 Pro 安装 debian testing/trixie/sid 驱动扬声器,外部耳机,外接显示器过程分享 不借助 mirror 仓库,为docker engine daemon添加 proxy 访问 docker hub,解决国内公开的docker mirror 仓库不再可用了的问题 徒步江苏镇江句容九连尖 macOS 安装 proxychains-ng 并借助局域网 socks5 代理使用 Google Earth Pro 修复一块 18 年 12 月买的二手 4TB 机械硬盘 iCloud 在 Windows 下很流氓,用 taskkill 干掉它 2023 年 12 月 Spotify 彻底被墙,我在比亚迪车机上安装 surfboard 挂代理听歌 利用 proxychains 让 Windows10/11 上的 Google Earth Pro 通过代理正常访问 湖州安吉天荒坪盘山公路和杭州临安浙西天路之旅 Redmi K70 首发开箱和拍照体验 Review Android 13+ 通过 Shizuku + Language Selector 给特定应用设置独立语言 我的 2023 Spotify Wrapped 听歌总结 压缩剪贴板内图片并立即写入剪贴板,减轻服务器存储压力 【Allen Hua 翻唱】山阴路的夏天和一个人的北京 初涉录音设备,记录我购买声卡和麦克风的曲折经历以及第一首翻唱陶喆——流沙 soul power 版本(low quality) 特种兵旅行之马鞍山一日游 给我的 .com 域名续期以及转移域名(GoDaddy 到 Cloudflare) 看《下辈子我再好好过》第三季 使用油猴脚本干掉B站web首页的浏览器插件警告信息 闯进我平静生活的三只猫 在远离中短视频几天之后 [可能是]最好的压缩图片程序,使用 squoosh-cli 批量压缩图片 再次出发,自驾徽州天路和黄山之行 nginx设置referer配置个人图床的防盗链功能 微博注销记 第一次4+2旅行,骑行皖南川藏线 让 rime 输入法用上颜文字 使用 nginx 获取自己的公网 IP 地址 2023 年 618 买了一台机械革命笔记本,但很不愉快 聊聊我晚睡的习惯和早点洗澡悟出来的原因 配置 ShadowsocksR Plus+ 的服务端,在外访问家中服务 部署一个 memos 作为个人微博站点和备忘录 我的听歌软件 Spotify 和网易云的故事 | 导出网易云的歌单再导入到 Spotify 我问 ChatGPT 为何印度人痔疮发病率低 使用 immich 来管理家庭照片 | 升级 immich 1.52.0 添加 typesense 容器 在 OpenWrt 上搭建 nfs server 利用 cron 和 curl 自动模拟登录馒头,防止账号被 ban 更新 Mattermost 服务端版本,由 7.4.0 更新到 7.8.0 获取 Seafile 分享的文件直链 你是科技产品偏执狂吗?一张不同种类互联网用户日常使用产品的分级图片 记录我的 V2EX 账号被封 不通过插件给 Typecho 博客添加图片灯箱功能(fancybox js 实现) 为 Typecho 博客添加 favicon.ico(网页标签小图标) OpenWrt 修改登录页面默认展示的 root 用户名信息,保护隐私 米家智能插座 3 上手初体验 互联网上为了保护隐私我们能做些什么?分享我的想法和我写的 link-cleaner tplink 10280, wan 无法访问 lan 下的 dhcp 主机,换上 padavan 解决两台路由器 lan-wan 级联,两台路由器下面的电脑互访 机械革命自带键盘总是自动乱按,拆机拔掉排线,完美解决烦恼 做了一个 squoosh docker 镜像,写博客贴图直接在本地压缩文件,安全且高效 nginx 常规端口和非常规端口的 http redirect to https 记一次 OpenWrt luci 显示正在“收集数据”,使用公网 IP nginx 反向代理遇到的 Uncaught TypeError: Cannot read properties of null (reading 'wan') 问题 OpenWrt 安装并配置腾讯云动态 dns dnspod tencent ddns 浅谈文件传输/共享协议|内网共享文件协议选择|自建公网文件管理同步和共享方案推荐 解决 webdav 连接 seafile 无法重命名文件等操作造成的 SeafDAV: MOVE returns 502 Bad Gateway 错误 Linux 删除当前目录下的隐藏文件 OpenWrt 安装 4.4.2 版本的 qbittorrent-nox Docker 构建多架构镜像实战 构建 amd64 和 arm64 架构的兰空图床镜像 构建 arm64 架构和 amd64 架构的兰空图床 docker 镜像
centOS7 安装 seafile 并部署https踩坑分享 | python多版本问题 | yum无法使用问题 | seahub 无法启动 | systemctl中无法自启 seahub service | 使用 rc.local 自启seafile和seahub
Allen Hua · 2020-09-06 · via Allen Hua 的网络博客

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

一、安装 seafile

使用 docker 安装 seafile 成功 但是 部署 https 以及 上传下载文件有问题之后 放弃使用 docker 部署 seafile

后改用 xiaoz.me 博客 提供的一键安装脚本安装。 CentOS 7一键安装Seafile搭建私有云存储: https://www.xiaoz.me/archives/8480 在此感谢原作者的分享!

我服务器 url 设置的是 https://static.hellodk.cn 那么我的 SERVICE_URLFILE_SERVER_ROOT 分别为

二、部署 https 通过 certbot-auto 申请 泛域名证书

首先分享一个 certbot-auto 部署最佳实践 Certbot-auto deployment best practices https://community.letsencrypt.org/t/certbot-auto-deployment-best-practices/91979

简而言之就是以下命令 (前提是你的系统基础环境已经具备)

wget https://dl.eff.org/certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto
/usr/local/bin/certbot-auto --help

安装好 certbot-auto 后可以使用 certbot-auto obtain a new certificate

certbot-auto certonly --email [email protected] -d "*.hellodk.cn" -d hellodk.cn --manual --preferred-challenges dns-01  --server https://acme-v02.api.letsencrypt.org/directory

ps: email 换成你自己的邮箱;-d 是域名,如果你申请的是 泛域名证书 请填写 *.example.comexample.com (example.com 是必须)

另外有一点,我的域名通过 cloudflare 解析并且代理了,如果想要通过此种方式申请证书,域名 example.com 的解析 必须以 A 记录方式指向当前运行的vps 或者 云服务器的 IP,不能使用 cloudflare 反代(通过 cloudflare 反代 ping example.com 会指向其他 IP地址),并且也不能使用 CNAME 记录。否则会报错,无法申请成功。我特意尝试过一次,见下图:
1657767878269.png

如果 example.com 指向了错误的地址,会 challenge failed

登录 cloudflare 的后台后,修改 dns 解析中的主机 A 记录,将代理取消 改为仅限 DNS,重新申请一遍,你可能需要修改 txt 记录中的 value (key保持不变)
重新设置好 txt 记录,等待 解析成功

linux 下通过 dig、mac 和 windows 下都可以使用 nslookup 测试 txt 记录是否已经生效

nslookup -type=txt hellodk.cn 223.5.5.5

查看返回 Authoritative answers 中是否有 txt 记录值

或通过 dig 查询是否能返回txt 记录的 value。如果有正确的string 返回则表明 txt 记录已经生效

然后重新申请 ssl

申请成功,证书保存在 /etc/letsencrypt/live/ 下

三、配置 nginx

参考官方文档 Nginx 下启用 Https https://manual-cn-origin.seafile.com/deploy/https_with_nginx

分享 我配置的 seafile.conf

server
{
    listen 443 ssl http2;
    server_name static.hellodk.cn;
    proxy_set_header X-Forwarded-For $remote_addr;
    #index index.php index.html index.htm default.php default.htm default.html;
    #root /www/wwwroot/hellodk.cn;    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;

    ssl on;
    server_tokens off;
    ssl_certificate    /etc/letsencrypt/live/hellodk.cn/fullchain.pem;
    ssl_certificate_key    /etc/letsencrypt/live/hellodk.cn/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_cache shared:SSL:10m;
    ssl_session_timeout 10m;

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

    # Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
    # ssl_dhparam /etc/nginx/dhparam.pem;

    #SSL-END

    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    error_page 404 /404.html;
    error_page 502 /502.html;
    #ERROR-PAGE-END

    #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:8000;
         proxy_set_header   Host $host:$server_port;
         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;

         # used for view/edit office file via Office Online Server
         client_max_body_size 0;

         access_log      /www/wwwlogs/seahub.access.log;
         error_log       /www/wwwlogs/seahub.error.log;
    }
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;

        send_timeout  36000s;
    }
    location /media {
        root /home/MyCloud/seafile-server-latest/seahub;
    }

    access_log  /www/wwwlogs/seahub.access.log;
    error_log  /www/wwwlogs/seahub.error.log;
}

server {
    listen       80;
    server_name  static.hellodk.cn;
    rewrite ^ https://$http_host$request_uri? permanent;    #强制将http重定向到https
    server_tokens off;
}

/ 匹配到 的 location 块中,proxy_set_header Host $host:$server_port 需要加上端口号

Change this line:  
proxy_set_header Host $host;

to this:  
proxy_set_header Host $host:$server_port;

最终通过 nginx -t 和 nginx -s reload 重载 nginx 服务

四、遇到 python 多版本 和 yum 无法使用的问题

感谢这篇博客: 使用rpm安装crontab命令备忘 http://isunix.github.io/blog/2019/05/22/shi-yong-rpman-zhuang-crontabming-ling-bei-wang/

centos7.6删除重新安装python和yum https://www.cnblogs.com/ytkah/p/10223853.html (文中的相关 .rpm 包 你去 wget 可能 会 404 not found 需要自己重新找下)

后面卸载 python3 和 python2 重新安装 python 和 yum 遇到以下问题:

librpm.so.3: cannot open shared object file: No such file or directory

从那台 yum 没有问题的机器上(刚好也是 centOS7.6 的系统)拷贝了 /usr/lib64/librpm.so.3.2.2/usr/lib64/librpmio.so.3.2.2 这两个文件到当前机器

然后创建软链接 分别指向 /usr/lib64/librpm.so.3librpmio.so.3 cd 到 /usr/lib64 目录下 然后分别执行

ln -s librpm.so.3.2.2 librpm.so.3
ln -s librpmio.so.3.2.2 librpmio.so.3

之后我的 yum 重新工作

这个问题 真是搞了我好久(f**k)

五、seafile 和 seahub 的开机自启问题

我的 seafile seahub 启动shell 脚本如下

#启动服务
/home/MyCloud/seafile-server/seafile.sh start
/home/MyCloud/seafile-server/seahub.sh start

seahub 无法启动

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

修改 /etc/locale.conf 添加一行 LC_ALL="en_US.UTF-8" 注意等于号后面的 value 需要使用 双引号包裹起来 (单引号应该也可以)

google、baidu 了很久 通过 systemctl 来开机自启还是失败,最终把目标转向了即将被淘汰的 rc-local.service (就是 /etc/rc.d/rc.local 服务)。 /etc/rc.local 是个 link file 指向的就是 /etc/rc.d/rc.local

但还是来分享一下 seafile 和 seahub 的 unit script

# cat /etc/systemd/system/seafile.service
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target

[Service]
Type=oneshot
ExecStart=/home/MyCloud/seafile-server/seafile.sh start
ExecStop=/home/MyCloud/seafile-server/seafile.sh stop
RemainAfterExit=yes
User=k
Group=k

[Install]
WantedBy=multi-user.target
# cat /etc/systemd/system/seahub.service
[Unit]
Description=seahub service
After=network.target seafile.service

[Service]
# change start to start-fastcgi if you want to run fastcgi
Environment="LC_ALL=C"
ExecStart=/home/MyCloud/seafile-server/seahub.sh start
ExecStop=/home/MyCloud/seafile-server/seahub.sh stop
User=k
Group=k
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

为防止 这两个服务开机自启影响,请禁用他们 或者直接删掉

systemctl disable seafile
systemctl disable seahub

注意 service 的 script 里 User 和 Group 请指定 非 root 用户

最终 将开机自启脚本添加到 /etc/rc.d/rc.local 注意下 这个文件是否有 执行权限 如果没有 请 chmod +x /etc/rc.d/rc.local

也注意 /etc/rc.d/rc.local 的最后一行 必须 是 exit 0 否则开机自动执行脚本会失败

最后CentOS7.6 需要手动启动 rc-local 服务 (马上会是 deprecated 的服务了)(下面这句 设置开机自启。设置好后 reboot 机器)

systemctl enable rc-local.service

我在部署过程中,还有几点可以提醒大家

  • 要安装 python 的 requests 模块 可以通过 pip 安装 或者 通过 yum 安装 python-requests yum install python-requests
  • 通过 yum 安装 python-imaging yum install python-imaging
  • SERVICE_URLFILE_SERVER_ROOT 需要关注 是否配置有问题
  • 注意 /opt/seafile-data/seafile/conf 下的 5 个配置文件是否正确配置
    1. ccnet.conf
    2. gunicorn.conf
    3. seafdav.conf
    4. seafile.conf
    5. seahub_settings.py

期间还遇到两个问题,无法上传 avatar 和 logo。上传 avatar 报错: Upload a valid image. The file you uploaded was either not an image or a corrupted image. 这个问题 我google baidu bing doge 都搜索不到 太郁闷了

上传头像提示我请上传一个有效的图片。该文件要么不是图片要么已经损坏。我:???损坏你 daye 的,换了很多图片都是这个错误

上传 logo 提示 Internal server error

最终通过上面的问题排查和问题解决,上面两个问题也已经消失了…… 哎 一路坎坷啊


最终我的 seafile 服务完美运行, https://static.hellodk.cn

部署的过程中可能还会有很多不容易发现的坑我没有提及或者我也不知道,如果你遇到欢迎讨论。本篇分享 end.