Tengine 安装和基本使用

简介

Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。官网

准备

  1. 下载:http://tengine.taobao.org/download_cn.html 下载 Tengine-2.x.x.tar.gz 的文件
  2. 系统环境 根据需要的功能模块,需要准备以下软件
    yum -y install autoconf automake libtool gcc gcc-c++ openssl openssl-devel
    rewrite 需要pcre库 pcre-8.32.tar.gz 官网
    gzip 需要zlib库 zlib-1.2.8.tar.gz 官网
    ssl 需要openssl 尽量用系统的openssl-devel
    lua 需要LuaJIT LuaJIT-2.0.4.tar.gz 官网
    lua 需要ngx_devel_kit ngx_devel_kit-0.2.19.tar.gz 官网
    lua 需要lua-nginx-module lua-nginx-module-0.9.20.tar.gz 官网
    cache 需要 ngx_cache_purge ngx_cache_purge-2.3.tar.gz 官网
    echo 需要 echo-nginx-module echo-nginx-module-0.58.tar.gz 官网
    geoip 需要 ngx_http_geoip_module ngx_http_geoip2_module-1.0.tar.gz 官网
    naxsi 需要 naxsi-core naxsi-0.51-1.tar.gz 官网
    jemalloc 需要 jemalloc jemalloc-4.0.4.tar.gz 官网

安装

  1. pcre
    tar xzf pcre-8.32.tar.gz  
    cd pcre-8.3.2  
    ./configure  
    make && make install
  1. zlib
    tar xzf zlib-1.2.8.tar.gz
    cd zlib-1.2.8
    ./configure
    make && make install
  1. jemalloc
    tar xzf jemalloc-4.0.4.tar.gz
    cd jemalloc-4.0.4
    ./autogen.sh
    ./configure
    make && make install
  1. Tengine
tar xzf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --with-select_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_ssl_module --with-http_spdy_module --with-syslog --with-pcre=/usr/local/src/pcre-8.32 --with-jemalloc=/usr/local/src/jemalloc-4.0.4
make && make install

使用

1.设置为服务 保存以下代码到/etc/init.d/nginx

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
     echo -n $"Stopping $prog: "
     killproc $nginxd
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
 echo -n $"Reloading $prog: "
 #kill -HUP `cat ${nginx_pid}`
 killproc $nginxd -HUP
 RETVAL=$?
 echo
}
# See how we were called.
case "$1" in
start)
     start
     ;;
stop)
     stop
     ;;
reload)
     reload
     ;;
restart)
     stop
     start
     ;;
status)
     status $prog
     RETVAL=$?
     ;;
*)
     echo $"Usage: $prog {start|stop|restart|reload|status|help}"
     exit 1
esac
exit $RETVAL

2.设置为自启动

chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限

chkconfig nginx on #设置开机启动

service nginx restart #启动服务

以上是基本功能,下期介绍常用模块的功能和用法

问题集合
扩展阅读

Tengine 官方中文文档

转载于:https://my.oschina.net/2688/blog/604303

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值