Skip to content

Tengine

1、下载源码包

wget http://tengine.taobao.org/download/tengine-3.1.0.tar.gz

官方地址:https://tengine.taobao.org/download_cn.html

2、编译安装

2.1 安装依赖

yum install -y gcc gcc-c++ automake pcre-devel zlib-devel openssl-devel

2.2 编译安装

# 1.解压
tar xf tengine-3.1.0.tar.gz && cd tengine-3.1.0/

# 2.配置
./configure \
    --prefix=/usr/local/nginx \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_realip_module \
    --with-http_stub_status_module \
    --with-http_gzip_static_module \
    --with-pcre \
    --add-module=./modules/ngx_http_upstream_check_module

# 3.编译和安装
make && make install

2.3 检查

/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -V

3、创建service管理文件

cat > /lib/systemd/system/nginx.service <<EOF
[Unit]
Description=The nginx service that provide http and reverse proxy service
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target
EOF

4、设置开机自启并启动

systemctl daemon-reload
systemctl enable nginx.service --now # 开机自启并马上启动
systemctl status nginx.service