tengine快速安装

=============编译安装=========
wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
tar -zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2 

yum -y install pcre-devel openssl-devel gd-devel   


./configure --prefix=/data/tengine --with-cc-opt='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-file-aio --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_secure_link_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-ld-opt=-Wl,-E --with-pcre

make
make install


编辑配置文件
vim /data/tengine/conf/nginx.conf

worker_processes  auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 65535;

events {
    use epoll;
    multi_accept on;
    worker_connections 65535;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    charset       utf-8;
 
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent $request_time "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$proxy_add_x_forwarded_for" "$upstream_response_time" ';

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 64k;
    client_max_body_size 8m;
    
    server_tokens off;
    sendfile       on;
    tcp_nopush     on;
    tcp_nodelay    on;   
    keepalive_timeout  60;
  
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

server {
       listen 8880;
       server_name 127.0.0.1;
       location ~ ^/NginxStatus {
               stub_status on;
               access_log off;
               }
       }
    include     /data/tengine/conf.d/*.conf;
    include     /data/tengine/upstream.conf.d/*.conf;
}

编辑配置文件:

   /data/tengine/conf.d/*.conf;
   /data/tengine/upstream.conf.d/*.conf;


启动
/data/tengine/sbin/nginx -t  #语法测试
/data/tengine/sbin/nginx   启动


tengine命令行参数
-m 选项:显示所有编译的模块,Tengine支持动态模块,static表示静态编译,shared表示动态编译(后面接的是动态模块的版本)
'-l' 选项:  显示所有支持的指令
'-d' 选项:  输出配置文件的内容,包括'include'的内容

[root@10-9-58-137 ~]# /data/tengine/sbin/nginx -V  #注意是大写的V ,小写的v只显示版本信息
Tengine version: Tengine/2.1.2 (nginx/1.6.2)
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/data/tengine --with-cc-opt='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic' --with-file-aio 
--with-http_gzip_static_module 
--with-http_image_filter_module 
--with-http_realip_module 
--with-http_secure_link_module 
--with-http_ssl_module 
--with-http_stub_status_module 
--with-http_sub_module 
--with-ld-opt=-Wl,-E --with-pcre
loaded modules:
    ngx_core_module (static)
    ngx_errlog_module (static)
    .......省略中间的模块......
    ngx_http_upstream_ip_hash_module (static)
    ngx_http_upstream_consistent_hash_module (static)   #该模块是一个负载均衡器,使用一个内部一致性hash算法来选择合适的后端节点
    ngx_http_upstream_check_module (static)      #该模块可以为Tengine提供主动式后端服务器健康检查的功能。
    ngx_http_upstream_session_sticky_module (static)    #该模块是一个负载均衡模块,通过cookie实现客户端与后端服务器的会话保持, 在一定条件下可以保证同一个客户端访问的都是同一个后端服务器
    ngx_http_stub_status_module (static)    #stub_status模块主要用于查看Nginx的一些状态信息                ngx_http_stub_status_module
增加对每请求的响应时间的统计:在stub status模块中增加了自Tengine启动以来所有请求的总响应时间(request_time),单位为ms,可以用来统计一段时间的平均RT(response time):
    Active connections: 1
    server accepts handled requests request_time
     1140 1140 1140 75806
    Reading: 0 Writing: 1 Waiting: 0


 

转载于:https://my.oschina.net/u/1255588/blog/838448

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值