查看“Nginx安装Let’s Encrypt免费SSL证书”的源代码
←
Nginx安装Let’s Encrypt免费SSL证书
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=debian 10 201911= == Install Certbot == <pre> sudo apt-get install certbot python-certbot-nginx </pre> == just get a certificate== <pre> # sudo certbot certonly --nginx Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): evan886@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Which names would you like to activate HTTPS for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: linuxchina.net 2: blog.linuxchina.net 3: wiki.linuxchina.net 4: www.linuxchina.net 5: linuxsa.org 6: www.linuxsa.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1 Obtaining a new certificate Performing the following challenges: http-01 challenge for linuxchina.net Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/linuxchina.net/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/linuxchina.net/privkey.pem Your cert will expire on 2020-02-29. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le </pre> ==第零== 这里最了的办法了,不用再去理其它了,昨天就看了别的 搞了半天s呀 20170627 今天用了另外一个方法 20170125 <pre>pkg install py27-certbot certbot certonly --standalone -d wiki.linuxchina.net -d blog.linuxchina.net </pre> ==自动更新证书== <pre> #!/bin/sh service nginx stop && certbot renew && service nginx start #这个是别人的写法 也是不错 echo '0 3 * */2 * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"' >certbot-auto-renew-cron crontab certbot-auto-renew-cron </pre> 说明 --pre-hook 这个参数表示执行更新操作之前要做的事情,因为我有 --standalone 模式的证书,所以需要 停止 nginx 服务,解除端口占用。 --post-hook 这个参数表示执行更新操作完成后要做的事情,这里就恢复 nginx 服务的启用 https://certbot.eff.org/#freebsd-nginx https://my.oschina.net/u/2328699/blog/829503 ==第一== ===单域名=== <pre> #这是老办法了 git clone https://github.com/letsencrypt/letsencrypt cd letsencrypt ./letsencrypt-auto certonly --standalone --email evan886@gmail.com -d linuxchina.net -d www.linuxchina.net --debug </pre> ===泛域名=== <pre>#泛域名 注xxx.com请根据自己的域名自行更改 要续期的话,执行certbot-auto renew就可以了 ./certbot-auto --server https://acme-v02.api.letsencrypt.org/directory --email evan886@gmail.com -d "*.linuxchina.net" --manual --preferred-challenges dns-01 certonly </pre> ====泛域名申请参考==== [https://my.oschina.net/kimver/blog/1634575#comment-list 申请Let's Encrypt通配符HTTPS证书] [https://segmentfault.com/a/1190000015354547 Let's Encrypt 泛域名证书申请及配置] [https://www.v2ex.com/t/438200 Let's Encrypt 泛域名证书签发成功啦] [http://diamondfsd.com/lets-encrytp-hand-https/ Let's Encrypt 使用教程,免费的SSL证书] [https://www.xiaoz.me/archives/10050 使用acme.sh脚本申请Let’s Encrypt 泛域名SSL证书] ==第二、Let’s Encrypt免费SSL证书获取与应用== <pre>在完成Let’s Encrypt证书的生成之后,我们会在”/etc/letsencrypt/live/yourdomain/”域名目录下有4个文件就是生成的密钥证书文件。<br/> cert.pem – Apache服务器端证书<br/> chain.pem – Apache根证书和中继证书 #我们重点的是关注这个 fullchain.pem – Nginx所需要ssl_certificate文件 privkey.pem – 安全证书KEY文件 ssl_certificate /etc/letsencrypt/live/linuxchina.net/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/linuxchina.net/privkey.pem; #90天后自动更新 好像不行,有交互界面的 * * */90 * * /data/mon/autossl 详细的nginx https配置文件 #4 blog server { listen 80; # listen [::]:80 ipv6only=on default_server; listen 443 default ssl; #listen [::]:80; #ssl on; ssl_certificate /etc/letsencrypt/live/linuxchina.net/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/linuxchina.net/privkey.pem; server_name linuxchina.net www.linuxchina.net; #by evan if ($scheme = http) { return 301 https://$server_name$request_uri; } #by evan # server_name blog.linuxchina.net; charset utf-8; root /data/www/evan; index index.php index.html index.htm; 注意: ssl on 不要打开 ,不然会400 重新更新key 现在可以用更加简单的了 ,见文章最前面 #/bin/sh cd /data/www/ssl/letsencrypt #git clone https://github.com/letsencrypt/letsencrypt ./letsencrypt-auto certonly --renew-by-default --email evan886@gmail.com -d linuxchina.net -d www.linuxchina.net --debug</pre> =trouble shooting= <pre>IMPORTANT NOTES:<br/> - Congratulations! Your certificate and chain have been saved at<br/> /etc/letsencrypt/live/linuxchina.net-0001/fullchain.pem. Your cert<br/> will expire on 2017-03-13. To obtain a new or tweaked version of<br/> this certificate in the future, simply run letsencrypt-auto again.<br/> To non-interactively renew *all* of your certificates, run<br/> "letsencrypt-auto renew"<br/> - If you like Certbot, please consider supporting our work by: ssl_certificate /etc/letsencrypt/live/linuxchina.net-0001/<br/> ssl_certificate_key /etc/letsencrypt/live/linuxchina.net-0001/ fullchain.pem ; 删除原来的再把新生成的复制到原来的位置<br/> cp /etc/letsencrypt/live/linuxchina.net-0001/privkey.pem .<br/> cp /etc/letsencrypt/live/linuxchina.net-0001/fullchain.pem .<br/> </pre> =参考= 相关参考文档 这个官方的教程比较好 其实<br/> [https://certbot.eff.org/#freebsd-nginx https://certbot.eff.org/#freebsd-nginx] 安装文档 <br/> [https://github.com/certbot/certbot https://github.com/certbot/certbot] [http://stackoverflow.com/questions/8768946/dealing-with-nginx-400-the-plain-http-request-was-sent-to-https-port-error http://stackoverflow.com/questions/8768946/dealing-with-nginx-400-the-plain-http-request-was-sent-to-https-port-error] 实战申请Let’s Encrypt永久免费SSL证书过程教程及常见问题<br/> [http://www.laozuo.org/7676.html http://www.laozuo.org/7676.html] Let’s Encrypt SSL证书配置<br/> [http://www.jianshu.com/p/eaac0d082ba2# http://www.jianshu.com/p/eaac0d082ba2#] [https://my.oschina.net/kimver/blog/1634575 申请Let's Encrypt通配符HTTPS证书] [[Category:Nginx]] [[Category:Freebsd]]
返回至
Nginx安装Let’s Encrypt免费SSL证书
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息