Centos7安装Tengine

Tengine介绍

Tengine是淘宝开发的基于nginx的应用服务器,反向代理服务器。它兼容nginx的所有配置,并且在其上增加了很多实用的功能,例如动态模块加载,集成lua语言进行扩展等,在性能方面有了比较大的改进。官方网址 http://tengine.taobao.org/ 。

安装Tengine

  1. 安装必要的编译环境好

    # yum update
    # yum install gcc gcc-c++ autoconf automake pcre-devel openssl openssl-devel
    
  2. 安装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

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值