Let’s Encrypt 是一个免费及开放的提供凭证的机构(CA), 以下是在 Debian 及 Ubuntu 将 Let’s encrypt 配置到 Apache 的方法。
先用 apt-get 安装 Apache:
$ apt-get install apache2
然后启动 SSL 模组及重新启动 Apache:
$ sudo a2enmod ssl
$ sudo a2ensite default-ssl.conf
$ sudo systemctl restart apache2.service
$ sudo a2ensite default-ssl.conf
$ sudo systemctl restart apache2.service
要安装 Let’s Encrypt 到服务器, 需要使用 git 套件安装, 所以先要安装 git:
sudo apt-get -y install git
然后选择需要储存 Let’s Encrypt 的目录, 以下会 下载 Let’s Encrypt 的目录 “letsencrypt” 到 /usr/local/:
$ cd /usr/local
$ sudo git clone https://github.com/letsencrypt/letsencrypt
$ sudo git clone https://github.com/letsencrypt/letsencrypt
然后下载 Let’s encrypt:
# cd /root
# git clone https://github.com/letsencrypt/letsencrypt
# git clone https://github.com/letsencrypt/letsencrypt
这时系统会将 Let’s encrypt 的最新档案下载到 /usr/local/letsencrypt, 执行以下 script 产生 SSL certificate, 以下会以 yourdomain.com 昨为示范网域:
$ cd /usr/local/letsencrypt
$ sudo ./letsencrypt-auto —apache -d yourdomain.com -d www.yourdomain.com
$ sudo ./letsencrypt-auto —apache -d yourdomain.com -d www.yourdomain.com
然后选择 “Agree” 同意版权, 及输入电邮地址。
完成后, Let’s encrypt 会将凭证档案放到 /etc/letsencrypt/live/.
最后可以透过存取 HTTPS 页面测试是否成功配置, 例如: “https://www.your-domain.com”.