简单比较一下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. C# 什么是泛型 ?以及对泛型各方面的一些知识点的整理

    1.1 理解什么是泛型 在.NET 2.0,可以成为革命性壮举的, 就是引入了激动人心的特性——泛型..NET泛型是CLR和高级语言共同支持的一种全新的结构,实现了一种将类型抽象化的通用处理方式.在泛 ...

  2. Scanner扫描器的使用

    Scanner:扫描器,可以通过Scanner类扫描用户在控制台录入的数据. 1.导包 //导包快捷键Alt+Enter 2.创建键盘录入对象 //键盘录入对象的名称为 “sc” 3.接收数据 //将 ...

  3. nuget 包是如何还原包的

    nuget 是如何还原包的 Intro 一直以来从来都是用 nuget 包,最近想折腾一个东西,需要自己搞一个 nuget 包的解析,用户指定 nuget 包的名称和版本,然后去解析对应的 nuget ...

  4. 定时任务Cron

    Linux系统中的定时任务cron,一个很实际很有效很简单的一个工作,在日常的生产环境中,会被广泛使用的一个组件.通过设置时间.执行的脚本等内容,能够让系统自动的执行相关任务,很是方便. cron定时 ...

  5. 35 _ 队列1 _ 什么是队列.swf

    队列是一种可以实现一个先进先出的存储结构 什么是队列? 队列(Queue)也是一种运算受限的线性表.它只允许在表的一端进行插入,而在另一端进行删除.允许删除的一端称为队头(front),允许插入的一端 ...

  6. CCNA-Part3 - 数据链路层的趣事 - 走进交换机

    在这篇文章中,会先介绍局域网及其的组件,通过交换机延伸到 TCP/IP 中数据链路层,了解数据的传输介质,以及交换机的发展历程及原理. 最后介绍数据帧的格式. 在阅读后应该了解如下的内容: 什么是局域 ...

  7. 【Spring】内嵌Tomcat&去Xml&调试Mvc

    菜瓜:今天听到个名词“父子容器”,百度了一下,感觉概念有点空洞,这是什么核武器? 水稻:你说的是SpringMvc和Spring吧,其实只是一个概念而已,用来将两个容器做隔离,起到解耦的作用,其中子容 ...

  8. JQ三种提示框:提示信息框、确认框、输入文本框

    浏览器的三种提示框: alert()提示信息框 confirm()提示确认框 prompt()提示输入文本框 1.alert()提示信息框 效果: 实现代码: <script> alert ...

  9. 调用微信内置的方法及wx.config的配置问题

    首先请看网址: https://www.w3cschool.cn/weixinkaifawendang/h8ap1qe5.html 重点说下怎么配置wx.config(为了安全,所有的参数都在服务端获 ...

  10. Oracle 11g各种服务作用以及哪些需要开启

    Windwos server 2012 R2上成功安装Oracle 11g后共有7个服务,如果全局数据库名为orcl,则Oracle服务分别为 Oracle ORCL VSSWriter Servic ...