⭐⭐⭐ Spring Boot 项目实战 ⭐⭐⭐ Spring Cloud 项目实战
《Dubbo 实现原理与源码解析 —— 精品合集》 《Netty 实现原理与源码解析 —— 精品合集》
《Spring 实现原理与源码解析 —— 精品合集》 《MyBatis 实现原理与源码解析 —— 精品合集》
《Spring MVC 实现原理与源码解析 —— 精品合集》 《数据库实体设计合集》
《Spring Boot 实现原理与源码解析 —— 精品合集》 《Java 面试题 + Java 学习指南》

摘要: 原创出处 http://www.iocoder.cn/Nginx/Tengine-install/ 「芋道源码」欢迎转载,保留摘要,谢谢!


🙂🙂🙂关注**微信公众号:【芋道源码】**有福利:

  1. RocketMQ / MyCAT / Sharding-JDBC 所有源码分析文章列表
  2. RocketMQ / MyCAT / Sharding-JDBC 中文注释源码 GitHub 地址
  3. 您对于源码的疑问每条留言将得到认真回复。甚至不知道如何读源码也可以请教噢
  4. 新的源码解析文章实时收到通知。每周更新一篇左右
  5. 认真的源码交流微信群。

1. 概述

todo

2. Tengine 搭建

操作系统:CentOS

2.1 下载

打开 Tengine 下载页面,选择想要的 Tengine 版本。这里,我们选择 当前最新版本 2.3.2.tar.gz

# 下载
$ wget https://tengine.taobao.org/download/tengine-2.3.2.tar.gz

# 解压
$ tar -zxvf tengine-2.3.2.tar.gz
$ cd tengine-2.3.2

# 查看目录
$ ls -ls
4 -rw-rw-r-- 1 root root 889 Sep 5 14:25 AUTHORS.te
4 drwxrwxr-x 6 root root 4096 Sep 5 14:25 auto
292 -rw-rw-r-- 1 root root 298825 Sep 5 14:25 CHANGES
28 -rw-rw-r-- 1 root root 25609 Sep 5 14:25 CHANGES.cn
32 -rw-rw-r-- 1 root root 32748 Sep 5 14:25 CHANGES.te
4 drwxrwxr-x 2 root root 4096 Sep 5 14:25 conf
4 -rwxrwxr-x 1 root root 2502 Sep 5 14:25 configure
4 drwxrwxr-x 4 root root 4096 Sep 5 14:25 contrib
4 drwxrwxr-x 4 root root 4096 Sep 5 14:25 docs
4 drwxrwxr-x 2 root root 4096 Sep 5 14:25 html
4 -rw-rw-r-- 1 root root 1715 Sep 5 14:25 LICENSE
4 -rw-r--r-- 1 root root 46 Jan 14 23:50 Makefile
4 drwxrwxr-x 2 root root 4096 Sep 5 14:25 man
4 drwxrwxr-x 26 root root 4096 Sep 5 14:25 modules
4 drwxr-xr-x 2 root root 4096 Jan 14 23:50 objs
4 drwxrwxr-x 3 root root 4096 Sep 5 14:25 packages
4 -rw-rw-r-- 1 root root 3421 Sep 5 14:25 README.markdown
4 drwxrwxr-x 10 root root 4096 Sep 5 14:25 src
4 drwxrwxr-x 4 root root 4096 Sep 5 14:25 tests
4 -rw-rw-r-- 1 root root 43 Sep 5 14:25 THANKS.te

2.2 编译与安装

参考《Tengine 文档 —— 编译和安装》,进行编译与安装。

# 安装依赖
$ yum -y install gcc-c++
$ yum -y install pcre-devel
$ yum -y install openssl openssl-devel

# 配置、编译、安装
$ ./configure --add-module=modules/ngx_http_upstream_check_module
$ make
$ make install

Tengine 默认将安装在 /usr/local/nginx 目录。我们可以用 '--prefix' 来指定你想要的安装目录。

2.3 启动 Tengine 服务

执行如下命令,启动 Tengine 服务。操作如下:

# 进入 Tengine 安装目录
$ cd /usr/local/nginx

# 查看目录
$ ls -ls
4 drwxr-xr-x 2 root root 4096 Jan 15 00:31 conf # 配置文件
4 drwxr-xr-x 2 root root 4096 Jan 15 00:31 html # 内置 HTML
4 drwxr-xr-x 2 root root 4096 Jan 15 00:31 logs # 日志文件
4 drwxr-xr-x 2 root root 4096 Jan 15 00:31 sbin # 执行文件

# 启动 Tengine 服务
sbin/nginx

启动完成后,我们可以通过执行 curl http://127.0.0.1 命令,输出 Nginx 默认欢迎页。结果如下:

<!DOCTYPE html>
<html>
<head>
<title>Welcome to tengine!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to tengine!</h1>
<p>If you see this page, the tengine web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://tengine.taobao.org/">tengine.taobao.org</a>.</p>

<p><em>Thank you for using tengine.</em></p>
</body>
</html>

至此,我们完成了 Tengine 服务的搭建。

文章目录
  1. 1. 1. 概述
  2. 2. 2. Tengine 搭建
    1. 2.1. 2.1 下载
    2. 2.2. 2.2 编译与安装
    3. 2.3. 2.3 启动 Tengine 服务