简单比较一下Tengine 和Nginx

背景

使用最新的软件,可以处理一些bug,文章对CentOS6不做介绍(不会用)

推荐使用Tengine,理由是淘宝再用,兼容 Nginx 可以随时切换

Tengine-2.3.0+介绍

Github: Tengine: 【Star:9.2K】

https://github.com/alibaba/tengine

Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。

  • nginx-1.17.3的所有特性都是继承的,即它与nginx 100%兼容。
  • 支持转发代理的连接http方法。
  • 支持异步openssl,使用qat等硬件实现https加速。
  • 增强的操作监控,如异步日志回滚、DNS缓存、内存使用等。
  • 流模块中支持服务器名。
  • 更多的负载平衡方法,例如一致的散列和会话持久性。
  • 输入体过滤器支持。使用这个机制编写Web应用防火墙非常方便。
  • 动态脚本语言(lua)支持,这是非常有效的,并使其易于扩展核心功能。
  • 限制上游服务器(proxy、memcached、fastcgi、scgi、uwsgi)的重试次数。
  • 包括支持独立进程的机制。
  • 在系统负载或内存使用过多的情况下保护服务器。
  • 可以将多个CSS或JavaScript请求组合成一个请求,以减少下载时间。
  • 删除不必要的空白和注释以减小页面大小。
  • 可以对上游服务器执行主动健康检查。
  • 可以自动设置工作进程和CPU关联的数量。
  • Limit_Req模块通过白名单支持得到增强,在单个位置允许更多条件。
  • 增强的诊断信息使故障排除变得更容易。
  • 更多用户友好的命令行,例如,显示所有编译的模块和支持的指令。
  • 可以为某些MIME类型指定到期时间。
  • 错误页可以重置为“默认”。

Nginx-1.17.3+介绍

Github: Nginx: 【Star:9.8K】

https://github.com/nginx/nginx

Nginx 是一个高性能的 Web 和反向代理服务器, 它具有有很多非常优越的特性:

  • 作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率,这点使 Nginx 尤其受到虚拟主机提供商的欢迎。能够支持高达 50,000 个并发连接数的响应,感谢 Nginx 为我们选择了 epoll and kqueue 作为开发模型.

  • 作为负载均衡服务器:Nginx 既可以在内部直接支持 Rails 和 PHP,也可以支持作为 HTTP代理服务器 对外进行服务。Nginx 用 C 编写, 不论是系统资源开销还是 CPU 使用效率都比 Perlbal 要好的多。

  • 作为邮件代理服务器: Nginx 同时也是一个非常优秀的邮件代理服务器(最早开发这个产品的目的之一也是作为邮件代理服务器),Last.fm 描述了成功并且美妙的使用经验。

  • Nginx 安装非常的简单,配置文件 非常简洁(还能够支持perl语法),Bugs非常少的服务器: Nginx 启动特别容易,并且几乎可以做到7*24不间断运行,即使运行数个月也不需要重新启动。你还能够在 不间断服务的情况下进行软件版本的升级。

安装命令 ———#代表使用的root权限

检查环境信息

[root@ip104 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

1、下载安装包(使用离线或者在线方式)

1.1【离线方式自己下载】

  • 下载安装包安装Tengine-2.3.0
  • 下载pcre-8.39.tar.gz【依赖】
  • 下载zlib-1.2.11.tar.gz【依赖】
  • 下载openssl-1.0.1h.tar.gz【依赖】
  • 下载jemalloc-3.6.0.tar.bz2 【依赖】
  • 下载 tengine-2.3.0.tar.gz
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
# wget http://zlib.net/zlib-1.2.11.tar.gz
# wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
# wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
# wget http://tengine.taobao.org/download/tengine-2.3.0.tar.gz

1.2【在线方式】(推荐方式,配置Centos 7网络自动下载)

yum install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel

1.3【操作日志预览】

1.3.1 【yum install gcc-c++】 需要输入一次y 继续下载安装

[root@ip104 ~]#  yum install gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..............................等待,需要输入一次y 继续下载安装............................
Total download size: 31 M
Is this ok [y/d/N]: y
Downloading packages:
..............................等待............................
Complete!

1.3.2 【yum -y install pcre pcre-devel 】

[root@ip104 ~]# yum -y install pcre pcre-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..............................等待............................
Complete!

1.3.3【yum -y install zlib zlib-devel】

[root@ip104 ~]#  yum -y install zlib zlib-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package zlib-1.2.7-18.el7.x86_64 already installed and latest version
.............................等待............................
Complete!

1.3.4【yum -y install openssl openssl-devel】

[root@ip104 ~]#  yum -y install openssl openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
..............................等待............................
Complete!

2、解压安装包并安装软件(使用离线或者在线方式)

2.1 下载Tengine

 cd /usr/local/src/

 wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz

 ls

2.2 解压压缩生成编译(一条一条来)

tar -zxvf tengine-2.3.2.tar.gz

cd /usr/local/src/tengine-2.3.2

./configure 

make

sudo make install

2.3 解压安装包

[root@ip104 ~]# cd /usr/local/src/
[root@ip104 src]# wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
--2019-10-01 12:37:03-- http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
Resolving tengine.taobao.org (tengine.taobao.org)... 140.205.172.18
Connecting to tengine.taobao.org (tengine.taobao.org)|140.205.172.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2835884 (2.7M) [application/octet-stream]
Saving to: ‘tengine-2.3.2.tar.gz’ 100%[==============================================>] 2,835,884 531KB/s in 5.3s 2019-10-01 12:37:08 (521 KB/s) - ‘tengine-2.3.2.tar.gz’ saved [2835884/2835884] [root@ip104 src]# ls
tengine-2.3.2.tar.gz

2.4 操作日志预览

--------下载安装包--------
[root@ip104 tengine-2.3.2]# cd /usr/local/src/
[root@ip104 src]# ls
rarlinux-x64-5.4.0.tar.gz tengine-2.3.2 tengine-2.3.2.tar.gz
[root@ip104 src]#
--------编译安装--------
[root@ip104 tengine-2.3.2]# cd /usr/local/src/tengine-2.3.2
[root@ip104 tengine-2.3.2]# ls
AUTHORS.te CHANGES.cn configure html man packages tests
auto CHANGES.te contrib LICENSE modules README.markdown THANKS.te
CHANGES conf docs Makefile objs src
[root@ip104 tengine-2.3.2]#

3、配置Tengine并运行

Tengine完全兼容Nginx,因此可以参照Nginx的方式来配置Tengine。我们在此只列出Tengine中值得注意的功能。关于详细的Tengine的相对于Nginx的差别,可以访问变更列表。

3.1 配置后台服务

  • 输入以下命令
vi /lib/systemd/system/nginx.service 

  • 输入以下编辑内容。按键:esc 输入 :wq 保存配置文件
#配置 Tengine config
[Unit] Description=The nginx HTTP and reverse proxy server
After=syslog.target 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
------启动nginx服务
systemctl start nginx.service
------设置开机自启动
systemctl enable nginx.service
------停止开机自启动
# systemctl disable nginx.service
------查看服务当前状态
systemctl status nginx.service
------重新启动服务
systemctl restart nginx.service
------查看所有已启动的服务
systemctl list-units --type=service

3.2 操作日志

[root@ip104 src]# vi /lib/systemd/system/nginx.service
[root@ip104 src]# systemctl start nginx.service
[root@ip104 src]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-10-01 13:09:43 CST; 7s ago
Process: 8441 ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS)
Process: 8439 ExecStartPre=/usr/local/nginx/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 8444 (nginx)
Tasks: 2
Memory: 1.5M
CGroup: /system.slice/nginx.service
├─8444 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/ngi...
└─8445 nginx: worker process Oct 01 13:09:43 ip104 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 01 13:09:43 ip104 nginx[8439]: nginx: the configuration file /usr/local/nginx/... ok
Oct 01 13:09:43 ip104 nginx[8439]: nginx: configuration file /usr/local/nginx/conf...ful
Oct 01 13:09:43 ip104 systemd[1]: Started The nginx HTTP and reverse proxy server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ip104 src]#

至此结束,看到以下命令表示成功配置

                            Welcome to tengine!
If you see this page, the tengine web server is successfully
installed and working. Further configuration is required. For online documentation and support please refer to tengine.taobao.org. Thank you for using tengine.

4、相关操作命令,扩展安装Nginx

4.1 介绍 PCRE (http://www.pcre.org/)

PCRE 下载地址:

ftp://ftp.pcre.org/pub/pcre/

https://ftp.pcre.org/pub/pcre/

4.2 下载安装包、解压软件、编译安装

[root@ip104 src]# cd /usr/local/src/
[root@ip104 src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@ip104 src]# tar zxvf pcre-8.35.tar.gz
[root@ip104 src]# cd pcre-8.35
[root@ip104 pcre-8.35]# ./configure
[root@ip104 pcre-8.35]# make && make install

4.3 安装Nginx

[root@ip104 src]# cd /usr/local/src/
[root@ip104 src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@ip104 src]# tar zxvf nginx-1.6.2.tar.gz
[root@ip104 src]# cd nginx-1.6.2
[root@ip104 nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@ip104 nginx-1.6.2]# make
[root@ip104 nginx-1.6.2]# make install

4.3 Nginx 和 Tenginx 配置文件

vi /usr/local/nginx/conf/nginx.conf

server {
listen 80;
server_name example.com *.example.com;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
} --重新启动
systemctl restart nginx
--查看状态
systemctl status nginx

4.4 Nginx 和 Tenginx 查询配置

[root@ip104 ~]# cd /usr/local/nginx/sbin
[root@ip104 sbin]# ./nginx -V
Tengine version: Tengine/2.3.2
nginx version: nginx/1.17.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments:
[root@ip104 sbin]#

其他说明

相关资源后续更新

Linux常用命令

touch .bash_profile。配置环境变量

java -verbose-查看jdk安装路径

java -version-查看jdk版本

vim-编辑

pwd-查看当前工作路径

su root -切换到root下

netstat -ntlp //查看当前所有tcp端口

ps -ef | grep //查看进程号

ps命令将某个进程显示出来

【软件安装】CentOS7安装Tengine_2_3_2(Nginx 1_17_0)的更多相关文章

  1. virtualBox安装centos7并配置nginx php mysql运行环境

    virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...

  2. 最小化安装CentOS7 + xfce4 +PHP + nginx +mariadb 开发环境

    虚拟机自定义最小化安装,新增用户做为管理员,打开自动获取网络,桥接模式.所有的操作只有命令,不做解释,看不明白的可以自行搜索相关的资料. # 开头的行是注释行,# 开头的空行,我自己装机时做了快照.未 ...

  3. [macOS] macOS下,VirtualBox安装CentOS7.4, 搭建nginx, mysql, PHP5.6&PHP7.1

    准备工作 网络设置 相关教程:http://www.jianshu.com/p/e6ba699b5992 ifcfg-enp0s3配置 TYPE=Ethernet BOOTPROTO=dhcp DEF ...

  4. vmware安装centos7 安装redis windows7访问redis

    1.在windows7中安装vmware 2.在vmware中安装centos7 3.禁用centos7自带的firewalld.service 4.安装iptables防火墙 5.安装Redis 3 ...

  5. 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装

    系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...

  6. Centos7安装Nginx实战

    一.背景 最近在写一些自己的项目,用到了nginx,所以自己动手来在Centos7上安装nginx,以下是安装步骤. 二.基本概念以及应用场景 1.什么是nginx Nginx是一款使用C语言开发的高 ...

  7. linux(centos7) 安装nginx

    linux(centos7) 安装nginx 1.14(stable) 版本 Nginx配置文件常见结构的从外到内依次是「http」「server」「location」等等,缺省的继承关系是从外到内, ...

  8. 详解如何在CentOS7中使用Nginx和PHP7-FPM安装Nextcloud

    转载地址:https://www.jb51.net/article/109382.htm 这篇文章主要介绍了详解如何在CentOS7中使用Nginx和PHP7-FPM安装Nextcloud,会通过 N ...

  9. CentOS下的安装命令 安装Nginx 更新yum源 kali系统当中的软件管理命令(第五天)

    Linux下软件的安装:方式:yum/rpm/源码安装YUM安装(帮助管理员解决依赖关系):yum search mysqld 在源中搜索软件包yum install mysql-connector- ...

随机推荐

  1. < react router>: (路由)

    < react router> (路由): 思维导图: Atrial   文件夹下的index.js 文件内容: import React, { Component } from 'rea ...

  2. 用一杯茶时间搭建Gitea服务器

     一.简单介绍 Gitea搭建局域网内的基于git的代码托管服务器,可以实现的功能包括:组织管理.团队管理.组织仓库设定.团队仓库分配.组织及团队权限分配管理.仓库添加PC协作者.仓库添加组织团队.分 ...

  3. Android Studio 插件 ADBWifi 无线调试真机

    长话短说,步骤如下 Android Studio 安装插件 ADB Wifi.这一步可以选择AS->Settings->Plugins->Market搜索:或者可以选择去插件官网下载 ...

  4. 只需几行 JavaScript 代码,网页瞬间有气质了!

    最近在网上闲逛,发现一个特别好玩的 JavaScript 库,叫 RoughNotation.干嘛用的呢?就是在网页上给文字加标注,比如下划线.方框.高亮文字背景等,不过是手写风格的!截图给大家感受下 ...

  5. 如何去除List集合中重复的元素

    1.通过循环进行删除 public static void removeDuplicate(List list) { for ( int i = 0 ; i < list.size() - 1 ...

  6. 关于阿里云服务器Linux安装Tomcat后,外网不能访问解决方案

    这里需要提及三个方面的问题   第一个方面:Linux上启动防火墙的问题 当下比较流行的Linux镜像是CentOS,所以防火墙也随之变成了firewall,那么怎么操作这个防火墙呢?   #停止fi ...

  7. 【未完待续】MVC 之HTML辅助方法

    顾名思义,HTML辅助方法(HTML Helper)就是用来辅助产生HTML之用, 在开发View的时候一定会面对许多HTML标签,处理这些HTML的工作非常繁琐,为了降低View的复杂度,可以使用H ...

  8. 逻辑式编程语言极简实现(使用C#) - 3. 运行原理

    本系列前面的文章: 逻辑式编程语言极简实现(使用C#) - 1. 逻辑式编程语言介绍 逻辑式编程语言极简实现(使用C#) - 2. 一道逻辑题:谁是凶手 第二天,好为人师的老明继续开讲他的私人课堂. ...

  9. [Python] datetime.timedelta模块用法

    python使用datetime模块timedelta实现日期时间相加: python计算明天的日期: from datetime import datetime from datetime impo ...

  10. 「疫期集训day1」无言

    正式集训第一天,感觉没啥特别大的感受,无非是奥赛时间延长了,效率提高了,身外事少了 当然不止这些 感受1:有些曾经被恶的题现在仍然在恶心,例如昨天的farmcraft,今天的整数划分(和着多边形一块调 ...