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 javascript

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


./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-pcrejava

make
make installnode


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

worker_processes  auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 65535;算法

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

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;
}cookie

编辑配置文件:

   /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

相关文章
相关标签/搜索