IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]CentOS 6.5 下 Tengine 安装记录

    testcs_dn发表于 2016-05-20 15:59:09
    love 0

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

    官网:

    http://tengine.taobao.org/index_cn.html


    下载源码

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

    执行配置命令时,由于我的环境原因遇到以下几个错误,点击链接可查看解决方法:

    checking for C compiler ... not found


    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.


    ./configure: error: SSL modules require the OpenSSL library.
    You can either do not enable the modules, or install the OpenSSL library
    into the system, or build the OpenSSL library statically from the source
    with nginx by using --with-openssl=<path> option.

    安装

    make && make install
    最后部分输出:

    test -f 'src/http/ngx_http_request.h' && cp 'src/http/ngx_http_request.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_config.h' && cp 'src/http/ngx_http_config.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_core_module.h' && cp 'src/http/ngx_http_core_module.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_cache.h' && cp 'src/http/ngx_http_cache.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_variables.h' && cp 'src/http/ngx_http_variables.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_script.h' && cp 'src/http/ngx_http_script.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_upstream.h' && cp 'src/http/ngx_http_upstream.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_upstream_round_robin.h' && cp 'src/http/ngx_http_upstream_round_robin.h' '/usr/local/nginx/include'
    test -f 'src/http/ngx_http_busy_lock.h' && cp 'src/http/ngx_http_busy_lock.h' '/usr/local/nginx/include'
    test -f 'src/http/modules/ngx_http_ssi_filter_module.h' && cp 'src/http/modules/ngx_http_ssi_filter_module.h' '/usr/local/nginx/include'
    test -f 'src/http/modules/ngx_http_ssl_module.h' && cp 'src/http/modules/ngx_http_ssl_module.h' '/usr/local/nginx/include'
    test -f 'src/http/modules/ngx_http_reqstat.h' && cp 'src/http/modules/ngx_http_reqstat.h' '/usr/local/nginx/include'
    test -f 'objs/ngx_auto_headers.h'  && cp 'objs/ngx_auto_headers.h' '/usr/local/nginx/include'
    test -f 'objs/ngx_auto_config.h' && cp 'objs/ngx_auto_config.h' '/usr/local/nginx/include'
    make[1]: Leaving directory `/opt/tengine-2.1.2'

    修改配置文件:

    vi /usr/local/nginx/conf/nginx.conf

    启动服务:

    /usr/local/nginx/sbin/nginx

    访问:

    打开浏览器,输入以下地址访问吧:
    http://你的服务器IP/
    如果你修改了端口号,记得在后面加上端口
    http://你的服务器IP:88/

    开放防火墙端口

    如果你通过以上地址访问不了的话,通常是防火墙的原因!

    /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    /etc/init.d/iptables save

    再次访问,看到了吗?


    配置开机启动

    vi /etc/rc.d/rc.local
    在文件末尾添加“/usr/local/nginx/sbin/nginx”

    常用命令:

    重新加载配置文件:/usr/local/nginx/sbin/nginx -s reload
    停止服务:/usr/local/nginx/sbin/nginx -s stop
    其它命令:

    /usr/local/nginx/sbin/nginx -h  
    nginx version: nginx/1.7.5  
    Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]  
      
    Options:  
      -?,-h         : this help  
      -v            : show version and exit  
      -V            : show version and configure options then exit  
      -t            : test configuration and exit  
      -q            : suppress non-error messages during configuration testing  
      -s signal     : send signal to a master process: stop, quit, reopen, reload  
      -p prefix     : set prefix path (default: /usr/local/nginx/)  
      -c filename   : set configuration file (default: conf/nginx.conf)  
      -g directives : set global directives out of configuration file  

    文件权限问题:
    有可能因为目录、文件权限过高,导致无权访问文件,可以通过以下命令修改权限:
    chmod -R 777 ./uploadfile

    结束语

    一路装下来发现,就是外表的名字变了,内部还都是Nginx,可以完全按照Nginx的安装方式来安装。

    同样,你按照这个来安装Nginx也没有问题。


    参考
    CentOS6.5下Nginx1.7.4安装记录



沪ICP备19023445号-2号
友情链接