tengine安装

来源:互联网 发布:网络推广公司哪家好 编辑:程序博客网 时间:2024/05/18 22:46

tengine安装

  • tengine安装
  • 环境
  • 下载
  • 安装
  • 常用命令
    • 启动服务
    • 停止服务
    • 重新加载配置
    • nginx服务器版本和模块
    • 查看帮助
  • 配置文件
    • 隐藏nginx服务器版本
    • 混淆nginx服务器版本
    • 修改端口
  • 说明

环境

CentOS6.6 X86_64

下载

当前2015-11-26 tengine最新版为 Tengine-2.1.1.tar.gz

wget http://tengine.taobao.org/download/tengine-2.1.1.tar.gz

安装

tar -xf tengine-2.1.1.tar.gzcd tengine-2.1.1默认安装在/usr/local/nginx下,可以自己修改./configure --prefix=/usr/local/nginx确保配置没有问题,再进行编译makemake install(如果不是root用户执行,请使用sudo make install)

如果./configure,经常出现的错误及解决方法
./configure: error: the HTTP rewrite module requires the PCRE library.

yum install -y pcre pcre-devel 

./configure: error: SSL modules require the OpenSSL library.

yum install -y openssl-devel 

常用命令

进入安装目录的sbin目录下

cd /usr/local/nginx/sbin

启动服务

./nginx启动完成后,测试curl http://localhost/  查看输出,会看到Thank you for using tengine.服务启动成功也可以用浏览器打开 http://ip/

停止服务

./nginx -s quit

重新加载配置

./nginx -s reload

nginx服务器版本和模块

./nginx -m

查看帮助

./nginx -h

配置文件

配置文件位于安装目录的conf文件夹下 nginx.conf

隐藏nginx服务器版本

在http配置块中,增加 server_tokens off;例如:http {……省略配置server_tokens off;   ->即可隐藏版本号…….省略配置}测试curl -I http://localhost/修改前HTTP/1.1 200 OKServer: Tengine/2.1.1Date: Thu, 26 Nov 2015 10:07:22 GMTContent-Type: text/htmlContent-Length: 555Last-Modified: Thu, 26 Nov 2015 09:44:29 GMTConnection: keep-aliveETag: "5656d47d-22b"Accept-Ranges: bytes修改后HTTP/1.1 200 OKServer: TengineDate: Thu, 26 Nov 2015 10:08:36 GMTContent-Type: text/htmlContent-Length: 555Last-Modified: Thu, 26 Nov 2015 09:44:29 GMTConnection: keep-aliveETag: "5656d47d-22b"Accept-Ranges: bytes

混淆nginx服务器版本

修改源代码,把nginx版本任意修改

进入源代码目录cd tengine-2.1.1/src/corevim nginx.h ,修改12-16行中的nginx和tengine名称及版本 12 #define nginx_version      1006002 13 #define NGINX_VERSION      "1.6.2" 14 #define NGINX_VER          "nginx/" NGINX_VERSION 15  16 #define TENGINE            "Tengine" 17 #define tengine_version    2001000 18 #define TENGINE_VERSION    "2.1.1" 19 #define TENGINE_VER        TENGINE "/" TENGINE_VERSION示例 12 #define nginx_version      5001009 13 #define NGINX_VERSION      "5.1.9" 14 #define NGINX_VER          "aws/" NGINX_VERSION 15  16 #define TENGINE            "Taws" 17 #define tengine_version    3003003 18 #define TENGINE_VERSION    "3.3.3" 19 #define TENGINE_VER        TENGINE "/" TENGINE_VERSION 20  21 #define NGINX_VAR          "NGINX" 22 #define NGX_OLDPID_EXT     ".oldbin"修改完成后,重新编译安装测试查看效果[root@vtfsdb1 sbin]# curl -I http://localhost/HTTP/1.1 200 OKServer: Taws/3.3.3Date: Thu, 26 Nov 2015 10:19:37 GMTContent-Type: text/htmlContent-Length: 555Last-Modified: Thu, 26 Nov 2015 10:19:23 GMTConnection: keep-aliveETag: "5656dcab-22b"Accept-Ranges: bytes[root@vtfsdb1 sbin]# ./nginx -mTengine version: Taws/3.3.3 (aws/5.1.9)loaded modules:    ngx_core_module (static)    ngx_errlog_module (static)    ngx_conf_module (static)    ngx_dso_module (static)    ngx_syslog_module (static)    ngx_events_module (static)    ngx_event_core_module (static)...

修改端口

根据实际情况修改listen       8080;

说明

所有相关的目录,链接,参数等请根据实际情况自行调整。

0 0