tengine官网:http://tengine.taobao.org/
1、下载tengine源码包
[root@web03 ~]#wget http://tengine.taobao.org/download/tengine-2.3.3.tar.gz
2、安装依赖
[root@web03 ~]#yum install -y pcre-devel openssl-devel
3、编译安装
编译安装步骤:
./configure 配置(生成Makefile),指定各种位置,否则就会被安装到/usr/local/
make 编译(根据Makefile进行编译--->生成对应的命令)
make install 创建目录、复制文件...
编译安装tengine
[root@web03 ~]#tar xf tengine-2.3.3.tar.gz
[root@web03 ~]#cd tengine-2.3.3/
[root@web03 ~/tengine-2.3.3]#./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --add-module=modules/ngx_http_upstream_check_module --add-module=modules/ngx_http_upstream_session_sticky_module/
[root@web03 ~/tengine-2.3.3]#make -j 2 #-j 指定cpu核心数进行编译,默认是1
#检查编译的结构:
[root@web03 ~/tengine-2.3.3]#./objs/nginx -V
[root@web03 ~/tengine-2.3.3]#make install #这步如果不是正式编译安装,可以不执行
部分选项解析:
--prefix=:指定安装目录
--add-module=:添加模块,第三方模块
例如:
--add-module=modules/ngx_http_upstream_check_module
--add-module=modules/ngx_http_upstream_session_sticky_module/
备份原有的nginx命令
[root@lb01 ~]#mv /sbin/nginx /sbin/nginx-1.24.0
把./objs/nginx命令发送到lb01上
[root@web03 ~/tengine-2.3.3]#scp ./objs/nginx root@192.168.10.5:/sbin/
lb01重启nginx(tengine)
[root@lb01 ~]#systemctl restart nginx
查看一下:
[root@lb01 ~]#curl -v 192.168.10.5
......
< HTTP/1.1 200 OK
< Server: Tengine/2.3.3
< Date: Sat, 01 Jul 2023 02:30:22 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
nginx已经替换成tengine