tengine的简介
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和 特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打 造 一个高效、稳定、安全、易用的Web平台。
从2011年12月开始,Tengine成为一个开源项目,Tengine团队在积极地开发和维护着它。Tengine团队的核心成员来 自于淘宝、搜狗等互联网企业。Tengine是社区合作的成果,我们欢迎大家参与其中,贡献自己的力量。
一。安装过程
1》下载
http://tengine.taobao.org/download.html 找到下载包并且下载(Tengine-2.2.0.tar.gz)
2》解压
tar zxvf Tengine-2.2.0.tar.gz
3》配置检查
进入解压后的目录 ./configure
- 异常1:
- [root@bogon tengine]# ./configure
- checking for OS
- + Linux 3.10.0-327.el7.x86_64 x86_64
- checking for C compiler ... not found
- ./configure: error: C compiler cc is not found
- 也就是c编译器 gcc找不到
- 安装gcc yum -y install gcc
- 继续检查
- 异常2:
- checking for PCRE library ... not found
- checking for PCRE library in /usr/local/ ... not found
- checking for PCRE library in /usr/include/pcre/ ... not found
- checking for PCRE library in /usr/pkg/ ... not found
- checking for PCRE library in /opt/local/ ... not found
- ./configure: error: the HTTP rewrite module requires the PCRE library.
- You can either disable the module by using --without-http_rewrite_module
- 缺少pcre和pcre-devel 安装 yum -y install pcre pcre-devel
- 这里安装好后 可以通过
- Rpm -qa | grep pcre找到所有pcre的包
- Rpm -ql 完整包名 查看安装的路径
- 异常3:
- checking for OpenSSL library ... not found
- 缺少openssl和openssl-devel 安装 yum -y install openssl openssl-devel
- 继续检测成功 可以同构日志看到 需要pcre openssl zlib(安装openssl自动安装)的库
- checking for PCRE library ... found
- checking for PCRE JIT support ... found
- checking for OpenSSL library ... found
- checking for zlib library ... found
- creating objs/Makefile
4》安装
Make && make install 安装完成 安装目录为/usr/local/nginx
找到 /usr/local/nginx/sbin/nginx -V 查看所有加载的模块
- [root@bogon sbin]# ./nginx -V
- Tengine version: Tengine/2.2.0 (nginx/1.8.1)
- built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
- TLS SNI support enabled
- configure arguments:
- nginx: loaded modules:
- nginx: ngx_core_module (static)
- nginx: ngx_errlog_module (static)
- nginx: ngx_conf_module (static)
- nginx: ngx_dso_module (static)
- nginx: ngx_events_module (static)
/usr/local/nginx/sbin/nginx start|stop|restart 启动和关闭ngix服务
访问 http://ip地址(默认的端口为80)
5》nginx命令参数
nginx -m 显示所有加载的模块
nginx -l 显示所有可以使用的指令
nginx -t 检查nginx的配置文件是否正确
nginx -s 启动nginx
nginx -s reload 重启nginx
nginx -s stop 停止nginx
查看nginx的日志
cd /usr/local/nginx/logs more error.log
使用nginx访问路径
curl 地址
部署程序(模拟在一台机器上)
进入 cd/usr/local/nginx/conf 编辑nginx.conf
如下图:在server上添加
max_fails===最多失败3次
fail_timeout=======30秒之内不会在访问这个tomcat
如下图:在server里的location中添加划线问题
在linux上起动一个项目(端口不能和nginx的端口冲突)查看端口进入tomcat的conf目录 vi server.xml
在windows上也启动一个相同的项目======把项目放在tomcat的webapps目录下 进入tomcat的bin目录点击startup.bat启动项目
以上是轮询算法=====可以在项目中稍微修改一下内容 可以在浏览器访问的时候看到效果
第一次访问
刷新后的效果