戴兜

戴兜

Coding the world.
github
bilibili
twitter

Hello,Tengine!

hellotengine.png

Hello,Tengine!Bye,Nginx!

写在前面#

戴兜的小屋在今年二月中旬时更换了机房,因为戴兜发现国内访问 vultr 的洛杉矶机房要比东京机房快很多🧐。迁移完博客后突然想到了Tengine,之前因为懒没有使用,这次有时间不妨折腾一下。

戴兜的服务器为 Ubuntu 16.04 LTS,文中提到的命令,各位根据自己的服务器做相应修改哦!

一、 折腾前的准备#

安装必要的组件

apt install build-essential
apt install libpcre3-dev libpcre3  libssl-dev libssl1.0.0

https://github.com/jemalloc/jemalloc/releases 下载 jemalloc

tar jxvf jemalloc-5.1.0.tar.bz2
cd jemalloc-5.1.0
./configure
make
make install
pwd #获取jemalloc的路径

二、 获取 Tengine 源码#

直接前往 http://tengine.taobao.org 下载源码,基于 nginx1.8.1。

如果你对 nginx 的版本有所要求(比如需要使用 Brotli),可以 clone https://github.com/alibaba/tengine 的 master 分支,那是基于 nginx1.15.1 的,但是仍在更新,不稳定。

三、 编译 Tengine 源码#

编译是和 Nginx 一样的,如果你需要什么模块,也要在编译前配置好。

tar zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --with-jemalloc=[jemalloc的路径] --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_stub_status_module --with-file-aio 
make
make install

现在,~~ 冲一杯卡布奇诺,~~ 静静等待。在所有工作结束后,你只需要将原来 Nginx 的配置拷贝到 Tengine,就大功告成啦!是不是很简单!

四、 尾声#

目前版本的 Tengine 不支持 HTTP2 的流式上传,HTTP1.1 的流式上传是正常的。可能导致博客无法上传较大文件(使用 master 分支可以解决)

加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。