佛山网站建设在哪找,中国版动漫网站模板,有阿里云服务器 怎么做网站,房产政策最新消息笔者一台服务器装有 CentOS 7.9 系统#xff0c;运行 curl -V 查询 curl 的版本是 7.29#xff0c;这个老版本的 curl 不支持 HTTP/2 协议。为了使 curl 能连接HTTP/2#xff0c;curl 必须升级到至少7.46.0版本以上。查询 curl的官网得知当前最新版本是 8.8.0#xff0c;然…笔者一台服务器装有 CentOS 7.9 系统运行 curl -V 查询 curl 的版本是 7.29这个老版本的 curl 不支持 HTTP/2 协议。为了使 curl 能连接HTTP/2curl 必须升级到至少7.46.0版本以上。查询 curl的官网得知当前最新版本是 8.8.0然而再仔细看适用于 CentOS 系统的却是7.76.1版
经过一番摸索CentOS 是可以安装 8.8.0的需要手动编译才成功下面记录一下我手工升级的过程
1. 安装依赖
sudo yum groupinstall -y Development Tools
sudo yum install -y libnghttp2 libnghttp2-devel openssl-devel2. 下载并安装最新版本的curl
wget https://curl.se/download/curl-8.8.0.zip
unzip curl-8.8.0.zip
cd curl-8.8.0
./configure运行 ./configure 而不带参数的话大概率会报错如 于是按提示把这些 --with 开头的参数都加到 ./configure尝试运行
./configure --with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-nss --with-openssl --with-rustls --with-schannel --with-secure-transport --with-wolfssl嗯报了另一个错NSS use must be confirmed using --with-nss-deprecated. NSS support will be dropped from curl in August 2022. See docs/DEPRECATE.md NSS是一个提供网络安全相关服务的库系统检测到正在尝试使用NSSNetwork Security Services库而 curl 计划不再支持 NSS 。因此如确实要使用NSS就必须通过–with-nss-deprecated 参数显式指定这一点。 好吧调整一下configure参数
./configure --with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-nss --with-nss-deprecated --with-openssl --with-rustls --with-schannel --with-secure-transport --with-wolfssl又来报错–with-wolfssl but wolfSSL was not found or doesn’t work 暂时不用 wolfSSL 的话就去掉这个参数再尝试运行
./configure --with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-nss --with-nss-deprecated --with-openssl --with-rustls --with-schannel --with-secure-transport又是报错error: --with-rustls was specified but could not find rustls. 再尝试去掉 --with-rustls 参数
./configure --with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-nss --with-nss-deprecated --with-openssl --with-schannel --with-secure-transport这样编译过程开始有了进展不再报错。 编译成功了但是从上面截图的编译结果看来倒数第6行显示HTTP2: No (–with-nghttp2, --with-hyper)如果要启用 HTTP/2必须要再加多 --with-nghttp2, --with-hyper 参数再次编译。
./configure --with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-nss --with-nss-deprecated --with-openssl --with-schannel --with-secure-transport --with-nghttp2 --with-hyper编译如果没有报错就应该出现下图的样子HTTP2已经是 enabled 的状态。
3. 收尾工作
make
make install
sudo ldconfig4. 确认curl版本和HTTP/2支持
curl -V输出应包括类似以下内容
恭喜贺喜CentOS 可以破格用上最新版 curl 了。。