tengine安装

tengine安装

环境

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.gz
cd tengine-2.1.1
默认安装在/usr/local/nginx下,可以自己修改
./configure --prefix=/usr/local/nginx
确保配置没有问题,再进行编译
make
make 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 OK
Server: Tengine/2.1.1
Date: Thu, 26 Nov 2015 10:07:22 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Thu, 26 Nov 2015 09:44:29 GMT
Connection: keep-alive
ETag: "5656d47d-22b"
Accept-Ranges: bytes

修改后
HTTP/1.1 200 OK
Server: Tengine
Date: Thu, 26 Nov 2015 10:08:36 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Thu, 26 Nov 2015 09:44:29 GMT
Connection: keep-alive
ETag: "5656d47d-22b"
Accept-Ranges: bytes

混淆nginx服务器版本

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

进入源代码目录
cd tengine-2.1.1/src/core
vim 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 OK
Server: Taws/3.3.3
Date: Thu, 26 Nov 2015 10:19:37 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Thu, 26 Nov 2015 10:19:23 GMT
Connection: keep-alive
ETag: "5656dcab-22b"
Accept-Ranges: bytes

[root@vtfsdb1 sbin]# ./nginx -m
Tengine 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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值