一、说明 Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一个IMAP/POP3/SMTP服务。由于轻便性与性能较佳,受广大用户接受使用。 由于RSA的证书兼容性较广,各大浏览器能支持访问,缺点是运算速度相对会慢;而ECC 算法所需的 Key 更短,ECC 证书拥有比 RSA 证书加密速度更快,运算效率更高,但是唯一缺点就是ECC证书兼容性不高,会导致有些浏览器不能访问。两者部署能综合相互补全。Nginx服务器上部署并使用ECC+RSA双SSL证书,可以大大提高网站的访问速度,增加安全性,减少内存占用。 二、编辑Nginx.conf server { listen 443; #默认端口 server_name localhost; #网站域名 ssl on; root html; index index.html index.htm; ssl_certificate /xxx/xx/rsa.crt; #RSA证书路径 ssl_certificate_key /xxx/xx/rsa.key; #RSA证书私钥路径 ssl_certificate /xxx/xx/ecc.crt; #ECC证书路径 ssl_certificate_key /xxx/xx/ecc.key; #ECC证书私钥路径 ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #加密套件 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #加密协议 ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } } 三、强制跳转到https 编辑Nginx.conf,添加下面跳转语句: return 301 https://$host$request_uri; 最后,重启nginx即可。 |
|