tengine README

The project's README from github.com/alibaba/tengine. As one markdown file: README.md.


Tengine

Visit tengine.taobao.org for the full documentation, examples and guides.

GitHub license GitHub stars GitHub stars Build Status

Introduction

Tengine is a high-performance web server and reverse proxy originated by Taobao, the largest e-commerce website in Asia. It offers HTTP/3, Kubernetes Ingress support, zero-downtime dynamic configuration, active upstream health checks, and NTLS/TLCP (SM2/SM3/SM4), while remaining 100% compatible with nginx. Tengine has proven to be very stable and efficient on some of the top 100 websites in the world, including taobao.com and tmall.com.

Tengine has been an open source project since December 2011. It is being actively developed by the Tengine team, whose core members are from Taobao, Sogou and other Internet companies. Tengine is a community effort and everyone is encouraged to get involved.

Features

Installation

Container image

Multi-arch (amd64 + arm64) images with the full feature set -- Tongsuo (NTLS), xquic (QUIC/HTTP-3) and Lua -- are published on every release:

docker pull ghcr.io/alibaba/tengine:latest         # Debian based
docker pull ghcr.io/alibaba/tengine:latest-alpine  # Alpine based, smaller

docker run --rm -p 8080:80 ghcr.io/alibaba/tengine:latest

The server runs as /usr/sbin/tengine with /etc/tengine/tengine.conf; drop your own server blocks into /etc/tengine/conf.d/.

Distribution packages

Every release ships .rpm, .deb and .apk packages for the mainstream distributions (RHEL/Rocky/Alma/Anolis/openEuler/SLES, Debian/Ubuntu, Alpine) on both x86_64 and aarch64, attached to the release page:

dnf install https://github.com/alibaba/tengine/releases/download/3.2.0/tengine-3.2.0-<ts>.el9.x86_64.rpm

These packages install alongside a distribution nginx without conflicting. See packages/build/README.md for the exact feature set, how to build them yourself, and how the container images are produced.

From source

Tengine can be downloaded at https://tengine.taobao.org/download/tengine.tar.gz. You can also checkout the latest source code from GitHub at https://github.com/alibaba/tengine

To install Tengine, just follow these three steps:

./configure
make
sudo make install

By default, it will be installed to /usr/local/tengine. Everything is named after Tengine, which matches the layout used by the .rpm/.deb/.apk packages and the container images:

Default path
binary /usr/local/tengine/sbin/tengine
configuration /usr/local/tengine/conf/tengine.conf
pid file /usr/local/tengine/logs/tengine.pid
error log /usr/local/tengine/logs/error.log
access log /usr/local/tengine/logs/access.log
dynamic modules /usr/local/tengine/modules

You can use the '--prefix' option to specify the root directory, or --sbin-path, --conf-path, --pid-path, --error-log-path and --http-log-path to place the individual files. If you want to know all the 'configure' options, you should run './configure --help' for help.

Upgrading from 3.1.0 or earlier. Those releases installed to /usr/local/nginx as sbin/nginx driven by conf/nginx.conf. Because 3.2.0 writes to different paths, make install does not replace that install -- the old binary stays on disk and keeps serving traffic, and running it still reports the old version, which easily reads as "the upgrade did not take effect". After switching over, stop and remove the old install, and update any systemd unit, init script or log rotation config still pointing at the old paths. configure prints a warning when it finds an install at /usr/local/nginx/sbin/nginx.

To keep the previous layout instead, pass the old paths explicitly:

./configure --prefix=/usr/local/nginx \
    --sbin-path=/usr/local/nginx/sbin/nginx \
    --conf-path=/usr/local/nginx/conf/nginx.conf \
    --pid-path=/usr/local/nginx/logs/nginx.pid

A plain ./configure builds without Tongsuo, xquic and Lua -- those need their own libraries. To reproduce the full feature set of the released packages and images, use the packaging helpers:

packages/build/fetch-deps.sh                       # download pinned sources
packages/build/build-deps.sh --libdir /usr/lib/tengine
. dist/deps-build/deps-env.sh
./configure $(sh packages/build/configure-args.sh) \
    --with-cc-opt="-Wno-error" \
    --with-ld-opt="$(sh packages/build/configure-args.sh --print-ld-opt)" \
    --with-openssl-opt="$(sh packages/build/configure-args.sh --print-openssl-opt)"
make

Documentation

The homepage of Tengine is at https://tengine.taobao.org/ You can access https://tengine.taobao.org/documentation.html for more information.

Contact

https://github.com/alibaba/tengine/issues

Dingtalk user group: 23394285

License

BSD-2-Clause License

Tengine

tengine (alibaba/tengine)

Searching Database…

13.4K ·GitHub
这是什么?Tengine 是一款高性能的 Web 服务器和反向代理,由淘宝发起开发。它基于 nginx 分支开发,与 nginx 100% 兼容,同时增加了一些面向企业的额外功能。
它基本上就是带额外功能的 nginx,还是一个完全不同的服务器?它继承了 nginx 的全部功能(目前基于 nginx-1.31.5),与 nginx 100% 兼容,因此现有的 nginx 配置和模块都可以直接使用。此外,它还增加了自己的功能,比如 HTTP/3、动态配置和 Lua 脚本。
我该如何安装和运行它?你可以拉取多架构容器镜像,为主流发行版安装预编译的 .rpm/.deb/.apk 软件包,或者使用 ./configure、make、make install 从源码构建(默认安装到 /usr/local/tengine)。
像 QUIC 或 SM2 TLS 这类功能,我需要额外安装库吗?需要。直接执行 ./configure 构建时不包含 Tongsuo、xquic 和 Lua,这些功能需要各自的库。因此,若要获得完整功能(NTLS/TLCP、HTTP/3、Lua),你必须借助打包辅助工具进行构建,或者直接使用预编译的容器镜像或软件包。
从旧版 Tengine 升级顺利吗?不太顺利。从 3.1.0 或更早版本升级比较麻烦:这些版本安装到 /usr/local/nginx,而 3.2.0 及以后版本使用不同的路径,因此 make install 不会替换旧的二进制文件,旧服务仍在运行。这会让人误以为升级悄无声息地失败了,除非你手动停止旧版本并更新服务配置。
通常哪些人在用它?它支持 Kubernetes 吗?它面向需要 nginx 级别性能并希望获得更多功能的网站,已在 taobao.com、tmall.com 等排名前百的网站上得到验证。它还配套提供 tengine-ingress Kubernetes Ingress 控制器,可在无需重新加载的情况下动态配置服务器和上游。
NTLS/TLCP 支持是用来做什么的?它通过 Tongsuo 实现了双证书 TLS,使用中国国家密码算法 SM2、SM3、SM4,符合 GM/T 0024 标准,主要用于满足中国的安全合规要求。
Tengine 支持 HTTP/3 吗?支持。它集成了 xquic 库,可支持 QUIC v1 和 draft-29,在不稳定的网络环境下延迟更低、韧性更强。
后端服务器出故障时会怎样?Tengine 会主动对上游进行健康检查,并可根据响应状态码切换到备用上游或进行重定向。对于 proxy、memcached、fastcgi、scgi、uwsgi 后端,还设有重试次数限制。
我能用脚本扩展 Tengine 的行为吗?可以。它内置了 Lua 脚本支持,让你能高效地扩展核心功能,包括利用其输入请求体过滤机制编写自定义的 Web 应用防火墙。
Creator
alibaba
Size
25.9 MB
Stars
13.4K
Age
14y
Commits · 90 Days