Tengine介绍
Tengine是淘宝开发的基于nginx的应用服务器,反向代理服务器。它兼容nginx的所有配置,并且在其上增加了很多实用的功能,例如动态模块加载,集成lua语言进行扩展等,在性能方面有了比较大的改进。官方网址 http://tengine.taobao.org/ 。
安装Tengine
-
安装必要的编译环境好
# yum update # yum install gcc gcc-c++ autoconf automake pcre-devel openssl openssl-devel
-
安装Tengine
useradd -s /sbin/nologin -M nginx
./configure --prefix=/usr/local/tengine --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre
make && make install
/usr/local/tengine/conf/nginx.conf根据服务器定义优化参数,与nginx.conf默认配置一样
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include /usr/local/tengine/conf/vhost/*.conf;
}
写入系统环境变量
export PATH=/usr/local/tengine/sbin:$PATH
Centos7配置Tengine,设置tengine开机自启,写入systemctl
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPost=/bin/sleep 0.1
ExecStartPre=/usr/local/tengine/sbin/nginx -t -c /usr/local/tengine/conf/nginx.conf
ExecStart=/usr/local/tengine/sbin/nginx -c /usr/local/tengine/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
LimitNOFILE=1000000
LimitNPROC=1000000
LimitCORE=1000000
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable nginx
systemctl start nginx