worker_processes auto; http { #配置共享会话缓存大小,视站点访问情况设定 ssl_session_cache shared:SSL:10m; #配置会话超时时间 ssl_session_timeout 10m; server { listen 443 ssl; server_name www.example.com; #设置长连接 keepalive_timeout 70; #HSTS策略 add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; #证书文件 ssl_certificate www.example.com.crt; #私钥文件 ssl_certificate_key www.example.com.key; #优先采取服务器算法 ssl_prefer_server_ciphers on; #使用DH文件 ssl_dhparam /etc/ssl/certs/dhparam.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #定义算法 ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"; #减少点击劫持 add_header X-Frame-Options DENY; #禁止服务器自动解析资源类型 add_header X-Content-Type-Options nosniff; #防XSS攻擊 add_header X-Xss-Protection 1;