nginx安装http2.0协议

nginx安装http2.0协议,第1张

nginx安装http2.0协议

HTTP2协议
HTTP 2.0 的主要目标是改进传输性能(视频插件路数),实现低延迟和高吞吐量。
编译安装nginx

#1.安装依赖
[root@node1 ~]# yum install  -y  gcc  gcc-c++  pcre  pcre-devel  openssl-devel  zlib  zlib-devel
#2.下载安装
[root@node1 ~]# cd /usr/local/src/
[root@node1 src]# wget http://nginx.org/download/nginx-1.10.3.tar.gz
[root@node1 src]# tar xf nginx-1.10.3.tar.gz 
[root@node1 src]# cd nginx-1.10.3/
#3.编译参数
[root@node1 nginx-1.10.3]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx-1.10.3 --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module
[root@node1 nginx-1.10.3]# make && make install

修改nginx的配置文件

[root@node1 conf]# cat nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen     80;
        server_name  192.0.0.72;
        if ($scheme ~ http) {
            return https://$server_name:8443$request_uri;
        }
        location / {
            root   html;
            index  index.html index.htm;
        }
        location = /50x.html {
            root   html;
        }
    }
    server {
        listen    8443 ssl http2 default_server;
        server_name  10.0.0.71;
        ssl_certificate     key/server.crt;
        ssl_certificate_key key/server.key;
        location / {
            root   html;
            index  index.html index.htm;
        }
        location = /50x.html {
            root   html;
        }
    }
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4966524.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-13
下一篇 2022-11-13

发表评论

登录后才能评论

评论列表(0条)

保存