tengine3.1.0安装方法教程
tengine3.1.0安装方法教程
1、下载源码安装包
https://tengine.taobao.org/download/tengine-3.1.0.tar.gz
2、安装编译环境
yum install gcc pcre-devel openssl-devel zlib-devel -y
3、创建nginx用户和nginx组
sudo groupadd -f nginx && sudo useradd -r -g nginx -s "$(command -v nologin || echo /bin/false)" -d /var/cache/nginx -M -c "Nginx web server" nginx
或者以下命令(任选上面或者下面,一个就行)
groupadd -r nginx
useradd -r -g nginx -s /sbin/nologin -M nginx
4、解压tengine-3.1.0.tar.gz
解压到/usr/local目录下

5、进入目录开始并安装
cd /usr/local/tengine-3.1.0
./configure --user=nginx \
--group=nginx \
--prefix=/usr/local/tengine \
--sbin-path=/usr/local/tengine/sbin/nginx \
--conf-path=/usr/local/tengine/conf/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--with-compat \
--with-debug \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_sub_module \
--with-stream \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_realip_module
make && make install

6、创建tengine服务
[root@localhost sbin]# vim /etc/systemd/system/tengine.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStart=/usr/local/tengine/sbin/nginx -c /usr/local/tengine/conf/nginx.conf
ExecReload=/usr/bin/kill -s HUP $MAINPID
ExecStop=/usr/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
#以上自启代码结束
systemctl daemon-reload
7、具体配置
TLS1.2协议看https://www.cnblogs.com/niway/p/18711882
TLS1.3协议看https://www.cnblogs.com/niway/p/17553459
8、常用命令
检查默认配置文件语法
./nginx -t
启动
./nginx
指定配置文件启动
./nginx -c /etc/nginx/nginx.conf
强制快速停止
./nginx -s stop
优雅停止,处理完当前请求再退出
./nginx -s quit
重载配置
./nginx -s reload
查看进程
ps -ef | grep nginx
查看监听端口
ss -lntp | grep nginx
# 或
netstat -lntp | grep nginx
查看 80 / 443 端口
ss -lntp | grep -E ':80|:443'
测试HTTPS TLS
curl -vk https://127.0.0.1/
curl -vk --tlsv1.2 https://127.0.0.1/
curl -vk --tlsv1.3 https://127.0.0.1/
浙公网安备 33010602011771号