Tengine简介:
Tengine是由淘宝网发起的Web服务器项目。它在
Nginx
的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如
淘宝网
,
天猫商城
等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。
安装步骤:
wget
http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
tar -zxf
tengine-2.3.2.tar.gz
yum -y install pcre-devel
yum -y install gcc-c++
yum -y install openssl openssl-devel
./configure
make
make install
#user nobody;
#进程数 推荐设置成 和 CPU 个数一样
worker_processes 1;
# 下面是日志
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#error_log "pipe:rollback logs/error_log interval=1d baknum=7 maxsize=2G";
#pid logs/nginx.pid;
events {
#单进程最大句柄数 这边修改后linux 也需要修改 可以用 ulimit -a 查看系统的句柄数
worker_connections 10240;
}
# 负载均衡 , 默认轮询
# 权重 : 在 后 面加上 weight(1 ~10 )
# 所有算法 : 轮询(默认) , weight(权重) , ip_hash(取模)
upstrean tomcat{
server 127.0.0.1:8080 weight=10 max_conns=1000 max_fails=1 fail_timeout=20
# 权重为10 , 最大连接数为1000 如果超过1次连接失败,
#不在连接这台服务器 ,超过20秒就为连接失败
server 127.0.0.1:8081
}
http {
include mime.types;
#默认都是下载文件
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
#access_log "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G" main;
#在两个文件描述符之间传输数据,内核操作 ,避免了数据在内核缓冲区和用户缓冲区之间的拷贝,效率很高
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#是否开启压缩
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#access_log "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G" main;
location / {
# proxy_pass http://tomcat 将所有内容代理到 upstrean 中的tomcat 中
root html;
index index.html index.htm;
}
}
}