快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

Nginx配置开启Http2.0支持方法(2)

Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
从前述输出信息可以了解到,当前安装的curl还不支持HTTP2。

这时可参考如何启用curl命令HTTP2支持重新编译curl,加入HTTP2的支持。

 

方法三

 

安装Chrome插件HTTP/2 and SPDY indicator,安装完毕后访问启用HTTP2的站点,如果地址栏出现蓝色的闪电,说明站点已启用HTTP2。



 

完整的配置文件

 

如下是完整的配置文件,删除了一些与HTTP2特性不相关的内容。

 



worker_processes  1;



error_log  logs/error.log  debug;



 



events {



    worker_connections  1024;



}



 



http {



    include       mime.types;



    default_type  application/octet-stream;



    server_tokens off;



 



    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '



                      '$status $body_bytes_sent "$http_referer" '



                      '"$http_user_agent" "$http_x_forwarded_for"';



 



    access_log  logs/access.log  main;



 



    sendfile        on;



    tcp_nopush     on;



 



    keepalive_timeout  65;



    charset utf-8;



 



    server {



        listen 8080;



        server_name  192.168.0.107;



        if ($scheme ~ http) {



            return https://$server_name:8443$request_uri;



        }



    }



 



    server {



        listen       8443 ssl http2 default_server;



        server_name  192.168.0.107;



 



        ssl_certificate      /home/bnxbcom/software/nginx_conf/server.crt;



        ssl_certificate_key  /home/bnxbcom/software/nginx_conf/server.key;



 



        ssl_session_cache    shared:SSL:1m;



        ssl_session_timeout  5m;



 



        ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA';



        ssl_prefer_server_ciphers  on;



 



        add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" always;



        add_header X-Frame-Options SAMEORIGIN always;



        add_header X-XSS-Protection "1; mode=block" always;



        add_header X-Content-Type-Options nosniff;



 



        location ~ / {



            index  index.jsp;



            proxy_pass http://127.0.0.1:18080;



            proxy_set_header        referer           '';



            include proxy.conf;



        }



 



        #error_page  404              /404.html;



 



        # redirect server error pages to the static page /50x.html



        #



        error_page   500 502 503 504  /50x.html;



        location = /50x.html {



            root   html;



        }
顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论