网站http1升级http2

974人浏览 / 0人评论

一、查看网站

       1、查看网站http版本

[root@sb conf]# curl -I https://supertruck.net.cn/
HTTP/1.1 302 Found
Server: nginx/1.8.0
Date: Tue, 08 Sep 2020 06:00:58 GMT
Content-Length: 0
Connection: keep-alive
Set-Cookie: shiro.sesssion=a50fbe3f-3cdf-42d1-8629-a079163d6dfd; Path=/; HttpOnly
Location: http://supertruck.net.cn/login.jsp;JSESSIONID=a50fbe3f-3cdf-42d1-8629-a079163d6dfd
 

是http1.1哈

       2、查看版本信息

opensll版本需要在=<1.0.2版本以上

[root@kache ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.8.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-debug --with-http_stub_status_module

哦天呐,我的nginx编译安装的时候没有安装--with-http_v2_module 这个是支持http2的模块我丢,只能重新安装下nignx 了哦

 

二、nginx热添加模块

      1、进入nignx源码包

[root@kache nginx-1.8.0]# pwd
/install/package/nginx-1.8.0
 

     2、进行编译

 ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-debug --with-http_stub_status_module  --with-pcre 
./configure: error: invalid option "--with-http_v2_module"

编译成功后make,记住千万不要make install,这样会覆盖你以前的nginx 

三、修改配置文件


server {
        listen 443 ssl http2 default_server;
 

完成 

全部评论