CentOS6.6 安装 Tengine 笔记

2019-10-17 20:28:05王振洲


cd /usr/local/src
wget http://zlib.net/zlib-1.2.8.tar.gz
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8.tar.gz
./configure --prefix=/usr/local/zlib
make && make install

D、jemalloc

jemalloc(http://www.canonware.com/jemalloc/)是一个更好的内存管理工具,使用jemalloc可以更好的优化Tengine的内存管理。

cd /usr/local/src
wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
tar jxvf jemalloc-3.6.0.tar.bz2
cd jemalloc-3.6.0.tar.bz2
./configure --prefix=/usr/local/jemalloc
make && make install

3、安装Tengine

在主要核心的组件安装完毕以后就可以安装Tegine了,最新版本的Tegine可从官网(http://tengine.taobao.org/)获取。
在编译安装前还需要做的一件事是添加一个专门的用户来执行Tengine。当然你也可以用root(不建议)。

groupadd www-data
useradd -s /sbin/nologin -g www-data www-data

接下来才是进行安装:


cd /usr/local/src
wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz
tar -zxvf tengine-2.1.0.tar.gz
cd tengine-2.1.0
./configure --prefix=/usr/local/nginx
--user=www-data
--group=www-data
--with-pcre=/usr/local/src/pcre-8.36
--with-openssl=/usr/local/src/openssl-1.0.2
--with-jemalloc=/usr/local/src/jemalloc-3.6.0
--with-http_gzip_static_module
--with-http_realip_module
--with-http_stub_status_module
--with-http_concat_module
--with-zlib=/usr/local/src/zlib-1.2.8
make && make install

注意配置的时候 –with-pcre 、–with-openssl、–with-jemalloc、–with-zlib的路径为源文件的路径。

4、配置Tengine,设置tengine自动启动

#vim /etc/rc.d/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=/usr/local/nginx/logs/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}