Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。

1.安装tengine

1.1.准备安装

[root@centos ~]# cd /usr/local/src/

下载 pcre-8.35.tar.gz到/usr/local/src

[root@centos ~]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz

下载zlib-1.2.8.tar.gz到/usr/local/src

[root@centos ~]# wget http://zlib.net/zlib-1.2.8.tar.gz

下载 openssl-1.0.1h.tar.gz到/usr/local/src

[root@centos ~]# wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz

下载jemalloc-3.6.0.tar.bz2到/usr/local/src

[root@centos ~]#  wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2

下载 tengine-2.0.3.tar.gz到/usr/local/src

[root@centos ~]# wget http://tengine.taobao.org/download/tengine-2.2.0.tar.gz

  

2.2 更新包

[root@centos ~]# yum install  zlib-devel  openssl-devel -y

2.3 安装Pcre

[root@centos ~]# cd /usr/local/src/

[root@centos ~]# tar zvxf pcre-8.35.tar.gz

[root@centos ~]# cd pcre-8.35

[root@centos ~]# ./configure

[root@centos ~]# make && make install

2.4 安装openssl

[root@centos ~]# cd /usr/local/src/

[root@centos ~]# tar zvxf openssl-1.0.1h.tar.gz

[root@centos ~]# cd openssl-1.0.1h

[root@centos ~]# ./config

[root@centos ~]# make && make install

2.5 安装zlib

[root@centos ~]# cd /usr/local/src/

[root@centos ~]# tar zlib-1.2.8.tar.gz

[root@centos ~]# cd zlib-1.2.8

[root@centos ~]# ./configure

[root@centos ~]# make && make install

2.6 安装jemalloc

[root@centos ~]# cd /usr/local/src/

[root@centos ~]# tar zvxf jemalloc-3.6.0.tar.bz2

[root@centos ~]# cd jemalloc-3.6.0

[root@centos ~]# ./configure

[root@centos ~]# make && make install

[root@centos ~]# echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf

[root@centos ~]# ldconfig

4.4 创建www用户和组,创建www虚拟主机使用的目录,以及Nginx使用的日志目录,并且赋予他们适当的权限

[root@centos ~]# groupadd www

[root@centos ~]# useradd -g www www

[root@centos ~]# mkdir -p /data/www

[root@centos ~]# chmod +w /data/www

[root@centos ~]# chown -R www:www /data/www

4.5 安装tengine

[root@centos ~]# cd /usr/local/src/

[root@centos ~]# tar zvxf /tengine-2.2.0.tar.gz

伪装服务器信息(可以不修改)

[root@centos ~]# cd nginx-1.6.0/src/core

[root@centos ~]# vim ./src/core/nginx.h

修改NGINX_VERSION为你希望显示的版号

修改NGINX_VER为你希望显示的名称

修改NGINX_VAR 为你希望显示的名称

开始安装tengine

./configure --prefix=/data/nginx --user=www --group=www --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_concat_module --with-pcre=/root/pcre-8.36 --with-zlib=/root/zlib-1.2.8 --with-http_ssl_module  --with-jemalloc

[root@centos ~]# make && make install

测试和运行

[root@centos ~]# cd /opt/nginx

[root@centos ~]# ldconfig

[root@centos ~]# ./sbin/nginx -t

如果显示下面信息,即表示配置没问题

nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful

输入代码运行nginx服务

[root@centos ~]# ./sbin/nginx 

[root@centos ~]# ps au|grep nginx

如果显以类似下面的信息,即表示nginx已经启动

root 2013 0.0 0.0 103156 856 pts/0 S+ 03:22 0:00 grep nginx

  

输入代码检测是否支持加速

查看是否生效

[root@centos ~]# lsof -n | grep jemalloc

ginx 2346 root mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2347 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2348 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2349 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2350 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1

[root@centos ~]# curl http://localhost

作为服务,开机后启动

[root@centos ~]# vim /usr/lib/systemd/system/tengine.service

增加以下内容

[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

:wq 保存退出

[root@centos ~]# systemctl stop tengine

[root@centos ~]# systemctl start tengine

[root@centos ~]# systemctl reload tengine

[root@centos ~]# systemctl enable tengine

[root@centos ~]# shutdown -r now

centos7 tengine 安装的更多相关文章

  1. 在centos7上安装Jenkins

    在centos7上安装Jenkins 安装 添加yum repos,然后安装 sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins ...

  2. CentOS7 Jenkins安装

    CentOS7 Jenkins安装 CentOS7 Jenkins安装 Download 从Jenkins下载apache-tomcat-8.0.18.tar.gz Install 安装 上传RPM文 ...

  3. 在 CentOS7 上安装 zookeeper-3.4.9 服务

    在 CentOS7 上安装 zookeeper-3.4.9 服务 1.创建 /usr/local/services/zookeeper 文件夹: mkdir -p /usr/local/service ...

  4. Tengine 安装配置全过程

    Tengine官网上有个非常简单的教程,中间并未涉及到一些常用的设置,所以仅供参考.一下午为本人的安装步骤及过程. 1.安装必要的编译环境好 由于Tengine安装需要使用源代码自行编译,所以在安装前 ...

  5. 在 CentOS7 上安装 MongoDB

    在 CentOS7 上安装 MongoDB 1 通过 SecureCRT 连接至 CentOS7 服务器: 2 进入到 /usr/local/ 目录: cd /usr/local 3 在当前目录下创建 ...

  6. 在 CentOS7 上安装 MySQL5.7

    在 CentOS7 上安装 MySQL5.7 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建 ...

  7. 在 CentOS7 上安装 Tomcat9

    在 CentOS7 上安装 Tomcat9 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建目 ...

  8. 在CentOS7上安装JDK1.8

    在CentOS7上安装JDK1.8 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建目录 to ...

  9. centos7.0 安装字体库

    最近在centos7.0下用itextpdf将word文档转成pdf时出现字体丢失的情况.网上找了很多资料,各式各样的原因和解决方法.后来经过一番测试发现是centos7.0 minimal没有安装相 ...

随机推荐

  1. 鼠标键盘失灵对策(Windows8.1)

    Win8.1虽然比Windows Server 2008R2开关机速度快好多.可惜用了一年后发现Win8.1 大bug. 鼠标键盘老是失灵... 对应方案: 1. 将鼠标键盘的USB插头更换位置,比如 ...

  2. jackson @ResponseBody 处理日期类型的字段

    前言:以前只知道一种方式(@JsonFormat)来处理日期格式问题,今天才发现还有两种方式,并且可以全局设置格式,这里记录一下. 首先,pom.xml 中需要先引入如下 jackson 的依赖: & ...

  3. xamarin.Android SQLite存储

    在可移植类库 新建: using SQLite.Net.Interop; using System; using System.Collections.Generic; using System.Li ...

  4. Github的readme.md的排版

    排版格式: 1 标题与文字格式 标题 # 这是 H1 <一级标题> ## 这是 H2 <二级标题> ###### 这是 H6 <六级标题> 文字格式 **这是文字粗 ...

  5. 移动端h5实现拍照上传图片并预览&webuploader

    .移动端实现图片上传并预览,用到h5的input的file属性及filereader对象:经测除了android上不支持多图片上传,其他基本ok实用: 一:先说一下单张图片上传(先上代码): html ...

  6. elixir 关键字列表

    关键字列表 元组列表 每个元素第一个为原子时候 称为关键字列表 iex(7)> list = [{:d, 1}, {:s, 2},{:h, 3}][d: 1, s: 2, h: 3]iex(8) ...

  7. 通过ajax记录打印信息

     润乾自带的打印直接可以通过触发js事件来进行调用.onClick="report1_print();return false;" 如果客户需要记录某个用户在某个时间段进行打印 ...

  8. 网络 TCP三次握手及滑动窗口

    三次握手客户端向服务器发出触发请求syn=1:因为这时还没有得到服务器的回应,所以ack=0服务器接收到客户端的触发请求,回复ack=1,表示已经接收到客户端的请求:同时服务器也向客户端发出触发请求, ...

  9. 5maven工程莫名其妙只在项目名称那里有一个红叉

    manven工程里面没有报错的地方,编译也没有问题,只是项目名称那里有一个红叉.   解决办法:   右击项目-->maven-->update project   注意: 这种方法有时可 ...

  10. shrio的简单认识

    博客讲解; shrio的知识储备 shrio的简单认识 笔记整理地址: Shrio.pdf 下载 Shrio理论.doc   下载 shrio知识储备.doc  下载