nginx SSL Labs A+配置

nginx.conf 加入:

listen 80;
listen 443 ssl http2;
#listen [::]:80;
ssl_certificate /etc/letsencrypt/live/root9000.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/root9000.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
server_name root9000.com www.root9000.com;
index index.html index.htm index.php default.html default.htm default.php;
root  /home/wwwroot/root9000.com;
if ($ssl_protocol = "") { return 301 https://$server_name$request_uri; }

LNMP默认没有启用http2,可以在lnmp.conf 里的Nginx_Modules_Options 中加入
--with-openssl=/root/openssl-1.0.2h
并执行:
cd /root && wget -c https://www.openssl.org/source/openssl-1.0.2h.tar.gz && tar zxf openssl-1.0.2h.tar.gz
然后使用升级脚本升级nginx至1.9.5或更高版本。
cd /root/lnmp1.3-full && ./upgrade.sh nginx
隐藏PHP版本
;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;

; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
; http://php.net/expose-php
expose_php = Off

测试地址 https://www.ssllabs.com/ssltest/index.html