安装gcc make等编译工具
$ yum -y install gcc gcc-c++ autoconf automake unzip bzip2
安装pcre
官方下载地址:https://ftp.pcre.org/pub/pcre/
注意:不要下载pcre2,下载pcre最新版本
$ cd ~/
$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.zip
$ unzip pcre-8.44.zip
$ cd pcre-8.44
$ ./configure --prefix=/usr/local
$ make && make install
安装openssl
官方下载地址:http://www.openssl.org/source/
$ cd ~/
$ wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
$ tar zxvf openssl-1.1.1d.tar.gz
$ cd openssl-1.1.1d
$ ./config --prefix=/usr/local
$ make && make install
安装zlib
$ cd ~/
$ wget http://www.zlib.net/zlib-1.2.11.tar.gz
$ tar zxvf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure --prefix=/usr/local
$ make && make install
安装jemalloc
官方下载地址:https://github.com/jemalloc/jemalloc/releases
$ cd ~/
$ wget https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2
$ tar jxvf jemalloc-5.2.1.tar.bz2
$ cd jemalloc-5.2.1
$ ./configure --prefix=/usr
$ make && make install
安装Tengine
官方下载地址:http://tengine.taobao.org/download.html
$ cd ~/
$ wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
$ tar zxvf tengine-2.3.2.tar.gz
$ cd tengine-2.3.2
$ ./configure --prefix=/usr/local/nginx \
--with-pcre=~/pcre-8.44 \
--with-openssl=~/openssl-1.1.1d \
--with-jemalloc=~/jemalloc-5.2.1 \
--with-zlib=~/zlib-1.2.11 \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-pcre-jit
$ make && make install
启动&测试
$ cd /usr/local/nginx/sbin
$ ./nginx
$ curl http://localhost
或者
$ curl http://127.0.0.1
输出结果:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to tengine!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to tengine!</h1>
<p>If you see this page, the tengine web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://tengine.taobao.org/">tengine.taobao.org</a>.</p>
<p><em>Thank you for using tengine.</em></p>
</body>
</html>
如果看到类似如上的输出内容,这说明安装成功。