实战环境
LNMP项目实战:
L:Linux(centos 7.6) http://mirrors.cqu.edu.cn/CentOS/7.6.1810/isos/x86_64/
N:Tengine(1.12.2)http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
主机信息:
部署规划:
172.24.77.242(sr2.dj.com):运行Tengine
172.24.77.241(sr1.dj.com):运行Tomcat

1 安装依赖包
#yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel glibc-headers gcc-c++
#yum -y install gcc \
gcc-c++ \ bzip2 perl curl curl-devel \
expat-devel gettext-devel openssl-devel \
libxml2 libxml2-devel libjpeg-devel libpng-devel \
freetype-devel libmcrypt-devel autoconf
#yum -y install epel-release
#yum -y install libmcrypt libmcrypt-devel mcrypt mhash
#cd /usr/local/src && wget http://zlib.net/zlib-1.2.11.tar.gz && tar zxvf zlib-1.2.11.tar.gz && cd zlib-1.2.11 && ./configure --prefix=/usr/local/zlib && make && make install
#cd /usr/local/src && wget https://www.openssl.org/source/openssl-1.1.1.tar.gz && tar zxvf openssl-1.1.1.tar.gz && cd openssl-1.1.1 && ./config --prefix=/usr/local/openssl && make && make install

2 添加安装用户

useradd www -s /sbin/nologin -M

3 下载Tengine安装包
#cd /usr/local/src/
#wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
Tengine编译安装
3.1 解压并安装
#tar xvf tengine-2.1.2.tar.gz -C /usr/local/
#/usr/local/tengine-2.1.2
#./configure --prefix=/usr/local/tengine \
--user=www \
--group=www \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre
Tengine编译安装_第1张图片
#make
Tengine编译安装_第2张图片
#make install
Tengine编译安装
3.2 查看安装结果
#whereis tengine
Tengine编译安装
#/usr/local/tengine/sbin/nginx –t
Tengine编译安装
启动Tenginx并测试访问
#/usr/local/tengine/sbin/nginx
Tengine编译安装
Tengine编译安装_第3张图片
4 安装 Tomcat
#yum install jdk-8u241-linux-x64.rpm
#ls /usr/java/
#vim /etc/profile.d/java.sh
#. /etc/profile.d/java.sh
#java -version
#echo $JAVA_HOME
#tar xf apache-tomcat-8.5.53.tar.gz -C /usr/local/
#cd /usr/local/
#ln -sv apache-tomcat-8.5.53 tomcat
#vim /etc/profile.d/tomcat.sh
#. /etc/profile.d/tomcat.sh
#catalina.sh version
#catalina.sh configtest
#catalina.sh start
#http://172.24.77.241:8080/
测试访问
Tengine编译安装_第4张图片
5 配置虚拟主机
#vim /usr/local/tengine/conf/nginx.conf
Tengine编译安装_第5张图片
测试配置文件
#/usr/local/tengine/sbin/nginx –t
重新加载Nginx
#/usr/local/tengine/sbin/nginx -s reload
6 测试访问
#http://172.24.77.242:9001/
Tengine编译安装_第6张图片