使用certbot免费升级到https
环境为 Ubuntu Server 16.04 和 Nginx,具体可参考官网,letsencrypt是certbot以前的名称,github的地址也重定向到certbot了。
Certbot, previously the Let’s Encrypt Client, is EFF’s tool to obtain certs from Let’s Encrypt, and (optionally) auto-enable HTTPS on your server. It can also act as a client for any other CA that uses the ACME protocol.
安装依赖
- sudo apt-get update
- sudo apt-get install python2.7 git -y
- sudo apt-get install software-properties-common
下载certbot
- git clone https://github.com/certbot/certbot.git
- cd certbot
新方式:
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-nginx
不重启获取证书
./certbot-auto certonly --webroot -w /var/www/your-project-dir -d your-domain.com -d another-domain.com
新方式:
$ sudo certbot –nginx
自动配置Nginx和更新证书。
配置nginx
1 | server{ |
重启 nginx 服务
sudo service nginx restart
到期自动更新
certbot renew --dry-run
如果正常工作(1.5版本有bug会报错),可以使用
certbot renew
待解决问题
1 | WARNING: unable to check for updates. |
有说是pip版本的问题,现在升级到最新版本也无用,正在解决。 (2017年4月6日23:23:36)
临时解决的方式,可以apt安装letscrypt,然后使用letscrypt certonly -w /your-project-dir -d your-domain.com
安装证书,然后配置证书。