Debian更新系统
1 |
apt update -y |
安装curl
1 |
apt-get update -y && apt-get install curl -y |
安装依赖
1 2 3 |
1:apt-get install -y openssl cron socat curl unzip vim 2:curl https://get.acme.sh | sh 3:source ~/.bashrc ##检查前两步是否有问题## |
申请证书
1 |
.acme.sh/acme.sh --issue -d 你的域名 --standalone -k ec-256 |
下载证书及密钥
1 |
.acme.sh/acme.sh --installcert -d 你的域名 --fullchainpath /etc/ssl/private/你的域名.crt --keypath /etc/ssl/private/你的域名.key --ecc |
赋予文件755权限
1 2 3 |
1:chmod 755 /etc/ssl/private 2:手动路径:/etc/ssl/private ##赋予证书及密钥755权限## 3:acme.sh --upgrade --auto-upgrade ##检查是否报错## |
设置自动证书任务
1 |
vi /etc/ssl/private/xray-cert-renew.sh |
替换以下模板内自己的域名
1 2 3 4 5 6 7 |
#!/bin/bash .acme.sh/acme.sh --install-cert -d a-你的域名 --ecc --fullchain-file /etc/ssl/private/你的域名.crt --key-file /etc/ssl/private/你的域名.key echo "Xray Certificates Renewed" chmod +r /etc/ssl/private/你的域名.key echo "Read Permission Granted for Private Key" sudo systemctl restart xray echo "Xray Restarted" |
赋予文件权限
1 |
chmod +x /etc/ssl/private/xray-cert-renew.sh |
设置自动任务
1 |
crontab -e |
设置每月1号自动申请证书
1 |
0 1 1 * * bash /etc/ssl/private/xray-cert-renew.sh |
阅读全文
评论前必须登录!
立即登录 注册