内容简介:SSL 证书是数字证书的一种,遵守 SSL 协议,具有服务器身份验证和数据传输加密的功能。这里主要采用了免费的 let's enscript 来在服务器上进行配置。acme.sh 会安装到 ~/.acme.sh 目录下注意
SSL 证书是数字证书的一种,遵守 SSL 协议,具有服务器身份验证和数据传输加密的功能。这里主要采用了免费的 let's enscript 来在服务器上进行配置。
1. 使用 acme.sh 来安装并生成证书
1.1 安装 acme.sh
acme.sh 会安装到 ~/.acme.sh 目录下
curl https://get.acme.sh | sh 复制代码
1.2 生成证书
注意 此处会占用 80 端口 (有时候自动失败,手动更新的时候尤其注意 nginx 占用 80),如果有其他进程占用了 80 端口要关闭,例如 nginx。 这里使用了 standalone 模式,此外还有 nginx apache 模式等,详情请看 github.com/Neilpang/ac…
~/.acme.sh/acme.sh --issue --standalone -d example.com -d www.example.com -d test.example.com (-k ec-256 可以选,-k 表示密钥长度) 复制代码
1.3 更新证书
let's enscript 的有效期只有 90 天,到期需要更新证书。acme.sh 脚本 60 天会自动更新一次,当然也可以手动更新 手动更新
~/.acme.sh/acme.sh --renew -d example.com -d www.example.com -d test.example.com --force --ecc 复制代码
1.4 安装证书和秘钥
多个域名只需要配置第一个就可以了,此处安装到 /etc/nginx/ssl/ 路径下(最好不好修改,手动更新的时候比较麻烦)
~/.acme.sh/acme.sh --install-cert --ecc -d example.com \ --key-file /etc/nginx/ssl/example.com.key \ --fullchain-file /etc/nginx/ssl/example.com.crt 复制代码
2. nginx 配置
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/wangshukeji.crt;
ssl_certificate_key /etc/nginx/ssl/wangshukeji.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
server_name example.com;
}
# 配置 302 转发
server {
listen 80;
server_name example.com;
return 302 https://example.com$request_uri;
}
复制代码
3. 通配符域名
// 阿里云控制台 accsess key 打开得到下面的值 export Ali_Key="key" export Ali_Secret="secret" acme.sh --issue --dns dns_ali -d example.com -d '*.example.com' // Namesilo export Namesilo_Key="xxxxxxxxxxxxxxxxxxxxxxxx" acme.sh --issue --dns dns_namesilo --dnssleep 900 -d example.com -d '*.example.com' acme.sh --renew -d example.com -d '*.example.com' 复制代码
中间会等待120s,生成的证书在 /root/.acme.sh/example.com/ 目录下,然后配置 fullchain.cer 和 example.com.key 即可。
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 网站HTTP升级HTTPS完全配置手册
- 基于Linux搭建Apache网站服务配置详解
- 使用IntelliJ IDEA开发SpringMVC网站(二)框架配置
- 如何为网站配置阿里免费SSL网络安全证书
- 为nginx服务器网站添加HTTPS/配置SSL证书
- 正确地配置一个安全的 https 网站 (nginx/Apache/Lighttpd)
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Domain-Driven Design
Eric Evans / Addison-Wesley Professional / 2003-8-30 / USD 74.99
"Eric Evans has written a fantastic book on how you can make the design of your software match your mental model of the problem domain you are addressing. "His book is very compatible with XP. It is n......一起来看看 《Domain-Driven Design》 这本书的介绍吧!