nginx 1.10启用http2

nginx下载:wget http://nginx.org/download/nginx-1.10.0.tar.gz

openssl下:wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz

前提:已购买ssl证书或者已申请免费ssl证书,本实例中只是对nginx做了升级操作,不是全新安装

步骤:

cd /data/soft
wget ftp://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz
tar zxvf openssl-1.0.2g.tar.gz
wget http://nginx.org/download/nginx-1.10.0.tar.gz
tar zxvf nginx-1.10.0.tar.gz
cd nginx-1.10.0
./configure --user=nobody --group=nobody --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl=../openssl-1.0.2g --with-http_v2_module --add-module=../nginx-http-concat
make -j2

效果:

nginx 1.10启用http2

nginx启用http2

nginx 1.10启用http2

nginx支持http2配置文件

server {
listen 443 ssl http2 default_server;
server_name www.olinux.org.cn;
ssl on;
ssl_certificate /data/htdocs/olinux/olinux.org.cn.crt;
ssl_certificate_key /data/htdocs/olinux/olinux.org.cn.key;
#缓存连接凭据
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:5m;
#禁止不安全的 SSL 协议,使用安全协议
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; 
#禁止已经不安全的加密算法
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
#缓解 BEAST 攻击
ssl_prefer_server_ciphers on;
#启用HSTS
add_header Strict-Transport-Security "max-age=63072000; preload";

您可以选择一种方式赞助本站

支付宝转账赞助

支付宝扫一扫赞助

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

图片 表情