- 安装基础依赖
yum -y install gcc gcc-c++ pcre-devel openssl-devel openssl
- tengine 官网下载压缩包
wget http://tengine.taobao.org/download/tengine-2.3.3.tar.gz
tar -xzvf tengine-2.3.3.tar.gz
- 进入解压目录
cd tengine-2.3.3
- 编译tengine
./configure --prefix=/data/opt/nginx
make & make install
- 配置nginx到系统服务
vim /usr/lib/systemd/system/nginx.service
# 内容如下
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/data/opt/nginx/sbin/nginx
ExecReload=/data/opt/nginx/sbin/nginx -s reload
ExecStop=/data/opt/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
- 设置开机启动
systemctl enable nginx
# 启动服务
systemctl start nginx