Openlist配置域名和SSL

前言

之前整了台2c2g的小鸡,一直放着吃灰不知道部署什么业务,最近了解到了OpenList这个项目,就想着自己部署来玩一玩,刚好能把之前白嫖到的E3 dev的5T onedrive利用上

作者配置的Alist

环境准备

1.推荐debian12或13

2.一个域名

OpenList的部署

一键安装脚本

curl -fsSL https://res.oplist.org/script/v4.sh > install-openlist-v4.sh && sudo bash install-openlist-v4.sh

配置ssl

第一步:安装 acme.sh

安装很简单,一条命令: email=my@example.com替换为你的邮箱,用于接收证书到期提醒。

curl https://get.acme.sh | sh -s email=my@example.com

或者

wget -O -  https://get.acme.sh | sh -s email=my@example.com

第二步:配置 DNS API 凭证(以 Cloudflare 为例)

export CF_Email="你的 Cloudflare 账户邮箱"
export CF_Key="你的 Global API Key" Cloudflare 的 API Key 可以从你的账户面板里查到(https://dash.cloudflare.com/profile/api-tokens)

第三步:申请证书

acme.sh --issue --dns dns_cf -d smart.yourdomain.com --server letsencrypt 证书申请成功后,acme.sh 会自动保存到 ~/.acme.sh/smart.yourdomain.com_ecc/ 下

自动续签策略说明

acme.sh 默认会每 60 天自动续签(因为ZeroSSL, Let's Encrypt 签发的证书是 90 天有效期)

绑定域名并开启ssl

打开文件/opt/alist/data/config.json,其中有如下内容:

"scheme": {
    "address": "0.0.0.0",
    "http_port": 5244,
    "https_port": -1,
    "force_https": false,
    "cert_file": "",
    "key_file": "",
    "unix_file": "",
    "unix_file_perm": ""
  }

把其中的http_port改成80,https_port改成443,force_https意思是强制https,可选择修改为'true'开启

其中有 cert_file和key_file两条配置,正对应着上次申请证书最后输出的Certificate is saved at:Key is saved at:,把后面的文件路径填进去,就配置好证书文件了

启用

大功告成!使用下面的命令重新启动OpenList

systemctl restart openlist

 

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注