Hello, Tengine! Bye, Nginx!
Introduction#
In mid-February of this year, Daidou's small house changed its data center because Daidou found that accessing Vultr's Los Angeles data center from China was much faster than the Tokyo data center. After migrating the blog, Daidou suddenly thought of Tengine, which he had not used before due to laziness. This time, he had time to tinker with it.
Daidou's server is Ubuntu 16.04 LTS. Please modify the commands mentioned in the article according to your own server!
Preparation before tinkering#
Install necessary components:
apt install build-essential
apt install libpcre3-dev libpcre3 libssl-dev libssl1.0.0
Download jemalloc from https://github.com/jemalloc/jemalloc/releases:
tar jxvf jemalloc-5.1.0.tar.bz2
cd jemalloc-5.1.0
./configure
make
make install
pwd # Get the path of jemalloc
Get Tengine source code#
Directly go to http://tengine.taobao.org to download the source code, based on nginx 1.8.1.
If you have specific requirements for the version of nginx (such as the need to use Brotli), you can clone the master branch of https://github.com/alibaba/tengine, which is based on nginx 1.15.1 but still being updated and unstable.
Compile Tengine source code#
The compilation process is the same as Nginx. If you need any modules, you should configure them before compiling.
tar zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --with-jemalloc=[path to 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
Now, make a cup of cappuccino, wait quietly. After all the work is done, you just need to copy the original Nginx configuration to Tengine, and you're done! Isn't it simple!
Conclusion#
The current version of Tengine does not support HTTP2 streaming uploads, but HTTP1.1 streaming uploads work fine. This may cause the blog to be unable to upload large files (this can be resolved by using the master branch).