Answers
key(服务器私钥) => csr(Certificate Signing Request,证书签发请求) => crt(证书)
上面几个东西都可以用openssl生成.
-
生成服务器.key文件
-
根据.key文件生成.csr文件
-
提交.csr给证书授权中心CA(Certificate Authority)
-
CA根据.csr制作.crt证书文件(CA认证后签发的服务器证书)和.ca文件(机构的公钥证书).
也可以自己用openssl生成crt证书,不过浏览器会警告用户证书没有被认证,但不影响通信加密.
Nginx提供有ngx_http_ssl_module模块,你用ssl_certificate_key指令指定key文件就好:
http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key
server {
listen 443 ssl;
keepalive_timeout 70;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
ssl_certificate /usr/local/nginx/conf/cert.pem;
ssl_certificate_key /usr/local/nginx/conf/cert.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
}
AokoRin
answered 9 years, 9 months ago