Tengine二进制安装与优化

   日期:2017-07-17

Tengine安装
环境:
redhat 7.2 ip:172.25.34.10
下载地址
http://tengine.taobao.org/download/tengine-2.2.0.tar.gz

安装所需的依赖
yum install -y gcc pcre-devel openssl openssl-devel

下载tengine
wget http://tengine.taobao.org/download/tengine-2.2.0.tar.gz

解压tengine
tar -xf tengine-2.2.0

编译
cd /tengine-2.2.0
./configure
make
make install

启动服务
cd /usr/local/nginx/sbin
./nginx

测试
curl -I 172.25.34.10

服务优化
创建启动配置文件
vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

刷新系统启动配置文件
systemctl daemon-reload
重启Tengine服务
systemctl restart nginx
设置开启启动
systemctl enable nginx
查看服务状态
systemctl status nginx