ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

centos7+nginx使用Certbot让网站拥有https

2020-02-22 15:03:11  阅读:323  来源: 互联网

标签:#### ssl xxx server centos7 nginx letsencrypt https com


centos7+nginx使用Certbot让网站拥有https
原创滥情丶 最后发布于2018-09-30 02:35:55 阅读数 1869 收藏
展开
certbot官网
1.获取certbot-auto
#### 下载
wget https://dl.eff.org/certbot-auto

#### 给予权限
chmod a+x ./certbot-auto

2.使用
#### 请改为自己的域名
./certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d "*.xxx.com" -d "xxx.com" --manual --preferred-challenges dns-01 certonly

#### 出现如下 输入邮箱
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):
#### 输入A同意
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:
#### 输入Y同意
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确认
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.
Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o:
#### 域名添加TXT解析 添加对应的域名和值 添加好后回车继续
Please deploy a DNS TXT record under the name
xxxx.xxxx.com with the following value:
xxxxxxxx
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
#### 出现如下即成功
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/xxxxx.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/xxxxx.com/privkey.pem
Your cert will expire on 2018-12-28. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew *all* of your certificates, run
"certbot-auto 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
3.nginx配置
server{
listen 80;
listen [::]:80;
server_name xxx.xxx.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name xxx.xxx.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/xxx.xxx.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/xxx.xxx.com/privkey.pem;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE:!kEDH;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/xxx.xxx.com/chain.pem;
#启用 HSTS 用于通知浏览器强制使用 https 通信
add_header Strict-Transport-Security "max-age=31536000";
resolver 8.8.8.8 8.8.4.4;


........
}
 

标签:####,ssl,xxx,server,centos7,nginx,letsencrypt,https,com
来源: https://www.cnblogs.com/duanweishi/p/12345400.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有