Tengine开启http2传输协议
- http2的优势
- 准备工作
1. 需要重新编译openssl1.0.2以上版本
2. 编译完成openssl后,需要重新使用openssl的库文件重新编译Tengine - 操作过程
1. 安装openssl-1.0.2t
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar -zxvf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t
./config shared zlib
make && make install
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/include/openssl /usr/include/openssl.old
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig -p
openssl version
2. 安装tengine
./configure --prefix=/usr/local/nginx --user=www --group=www --with-poll_module --with-pcre --with-http_realip_module --with-http_dav_module --with-http_gzip_static_module --with-http_degradation_module --with-http_addition_module --with-http_image_filter_module --with-http_sub_module --with-http_flv_module --with-http_slice_module --with-http_mp4_module --with-http_random_index_module --with-http_secure_link_module --add-module=/usr/local/nginx/modules/nginx-upsync-module --with-http_v2_module --with-http_secure_link_module --with-openssl=/usr/local/ssl
make
make install 如果是已经安装过tengine,不需要执行make install
cp -af objs/nginx /usr/local/nginx/sbin/
cp -af objs/dso_tool /usr/local/nginx/sbin/
./nginx -s stop
./nginx
3. 配置nginx的server
server {
listen 443 ssl http2; 加入http2
}
4. 浏览器访问页面,f12,出现h2字样
一往无前虎山行,拨开云雾见光明

浙公网安备 33010602011771号