https不仅仅安全,2017下半年开始各大搜索引擎会优先收录https站点,https消耗最大的是握手过程,所以要比http慢很多,很多站长不太愿意启用。下面按照我列出的方法,写入到你的配置当中,可以明显为给你的https加速,效果立竿见影!
#HTTP_TO_HTTPS_END ssl_certificate /etc/letsencrypt/live/你的域名/fullchAIn.pem; ssl_certificate_key /etc/letsencrypt/live/你的域名/privkey.pem; add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_stapling on; resolver 8.8.8.8 114.114.114.114 valid=3600s; ssl_prefer_server_ciphers on; ssl_stapling_verify on; ssl_dhparam dh2048.pem; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; error_page 497 https://$host$request_uri;
dh2048.pem默认是会报错的,因为需要自己手动生成,可以打开面板或者登陆ssh进行生成dh2048.pem文件
cd /www/ && openssl gendh -out dh2048.pem 2048 && cp -i /www/dh2048.pem /www/server/Nginx/conf/
然后在面板上将当前路径下的dh2048.pem复制放置/www/server/nginx/conf/下
然后到软件管理点击nginx的设置中重启一下nginx即可,可以提升证书的安全保密性的同时减少重复请求的耗时!