wget https://raw.githubusercontent.com/lukas2511/dehydrated/116386486b3749e4c5e1b4da35904f30f8b2749b/dehydrated
UPDATE: 下载最新版本:
wget https://raw.githubusercontent.com/lukas2511/dehydrated/master/dehydrated
下载后需要修改文件权限,建议放置到 /usr/local/sbin/
之下:
chmod +x dehydrated
mv dehydrated /usr/local/sbin/
mkdir /etc/dehydrated /var/www/dehydrated
curl https://raw.githubusercontent.com/lukas2511/dehydrated/116386486b3749e4c5e1b4da35904f30f8b2749b/docs/examples/config > /etc/dehydrated/config
curl https://raw.githubusercontent.com/lukas2511/dehydrated/116386486b3749e4c5e1b4da35904f30f8b2749b/docs/examples/hook.sh > /etc/dehydrated/hook.sh
chmod +x /etc/dehydrated/hook.sh
touch /etc/dehydrated/domains.txt
- 设置
CONTACT_EMAIL
; - 设置
HOOK=/etc/dehydrated/hook.sh
; - 设置
WELLKNOWN=/var/www/dehydrated
; - 修改
/etc/dehydrated/domains.txt
,添加相关域名。
location /.well-known/acme-challenge {
alias /var/www/dehydrated;
}
首次执行需要同意协议:
dehydrated --register --accept-terms -f /etc/dehydrated/config
然后通过命令生成证书:
dehydrated -f /etc/dehydrated/config -c
listen 80;
listen 443 ssl;
server_name www.example.com example.com;
ssl_certificate /etc/dehydrated/certs/example.com/fullchain.pem;
ssl_certificate_key /etc/dehydrated/certs/example.com/privkey.pem;
30 5 * * 0 /usr/local/sbin/dehydrated -c -f /etc/dehydrated/config > /dev/null
References: