一、說(shuō)明 Nginx (engine x) 是一個(gè)高性能的HTTP和反向代理服務(wù),也是一個(gè)IMAP/POP3/SMTP服務(wù)。由于輕便性與性能較佳,受廣大用戶接受使用。 由于RSA的證書(shū)兼容性較廣,各大瀏覽器能支持訪問(wèn),缺點(diǎn)是運(yùn)算速度相對(duì)會(huì)慢;而ECC 算法所需的 Key 更短,ECC 證書(shū)擁有比 RSA 證書(shū)加密速度更快,運(yùn)算效率更高,但是唯一缺點(diǎn)就是ECC證書(shū)兼容性不高,會(huì)導(dǎo)致有些瀏覽器不能訪問(wèn)。兩者部署能綜合相互補(bǔ)全。Nginx服務(wù)器上部署并使用ECC+RSA雙SSL證書(shū),可以大大提高網(wǎng)站的訪問(wèn)速度,增加安全性,減少內(nèi)存占用。 二、編輯Nginx.conf server { listen 443; #默認(rèn)端口 server_name localhost; #網(wǎng)站域名 ssl on; root html; index index.html index.htm; ssl_certificate /xxx/xx/rsa.crt; #RSA證書(shū)路徑 ssl_certificate_key /xxx/xx/rsa.key; #RSA證書(shū)私鑰路徑 ssl_certificate /xxx/xx/ecc.crt; #ECC證書(shū)路徑 ssl_certificate_key /xxx/xx/ecc.key; #ECC證書(shū)私鑰路徑 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; #加密協(xié)議 ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } } 三、強(qiáng)制跳轉(zhuǎn)到https 編輯Nginx.conf,添加下面跳轉(zhuǎn)語(yǔ)句: return 301 https://$host$request_uri; 最后,重啟nginx即可。 |
|