11# 基于Reactor的高性能网络服务器
22
3- 一个基于多路复用Reactor模式的高性能web服务器,底层实现使用epoll模型。
3+ - ** [ 简体中文 ] ( ./README-CN.md ) **
44
5- 我将继续更新这个项目,继续改进后端和前端的问题,并创建一个完整的项目。到目前为止,该项目已经完成了最基本的后端建设和简单的前端建设。
5+ - ** [ English ] ( ./README.md ) **
66
7- ** 其中,epoll在本项目中的基本原理和多路复用高性能IO的基本原理可以在我的其他repo中看到**
7+ A high-performance web server based on the multiplexed Reactor pattern, with the underlying implementation using the epoll model.
8+
9+ I will continue to update this project, improve the backend and front-end issues, and create a complete project. So far, the project has completed the most basic backend construction and simple frontend construction.
10+
11+ ** Among them, the basic principles of epoll in this project and the basic principles of multiplexing high-performance IO can be seen in my other repo:**
812** https://github.com/Yufccode/Multiplexing-high-performance-IO-server **
913
10- ## 1. 实现效果
14+ ## 0. Overall structure of Reactor server
15+
16+ ![ ] ( ./figs/0.png )
17+
18+ ## 1. Implementation effect
1119
1220
13- ** 后端效果 **
21+ ** Backend effects **
1422
15- ![ ] ( ./figs/1.png )
23+ ![ ] ( ./figs/1.png ) Backend effects
1624
17- 在后端可以在 ` stdout ` 中看到获取到的http请求报文,当然,我们也可以在日志文件中看到http报文。
25+ In the backend, we can see the obtained HTTP request message in ' stdout', and of course, we can also see the HTTP message in the log file.
1826
19- ** 前端效果 **
27+ ** Front end effects **
2028
21- 为个人博客展示。
29+ Display for personal blog.
2230
2331![ ] ( ./figs/2.png )
2432
25- ## 2. 运行方法
33+ ## 2. operating method
2634
27- ** 环境 **
35+ ** Env **
2836
2937- Linux ALiCentos7 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
3038
3139- gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
3240
33- 克隆该项目。
41+ clone from github.
3442
3543``` bash
3644git clone https://github.com/Yufccode/Reactor-based-HyperWebServer.git
3745```
3846
39- 进入该项目的文件夹中。
47+ enter the dir.
4048
4149``` bash
4250cd Reactor-based-HyperWebServer
4351```
4452
45- 生成可执行。
53+ make.
4654
4755``` bash
4856make clean;
4957make;
5058```
5159
52- 运行服务器。
60+ start the sever.
5361
5462```
5563./WebServer
5664```
5765
58- 注意:如果是云服务器运行本项目需要开放 ` 8080 ` 端口号,否则会因为防火墙而无法访问。
66+ Note: If running this project on a cloud server, the ' 8080' port number needs to be opened, otherwise it may be inaccessible due to the firewall.
5967
60- 打开浏览器,访问服务端。
68+ Open the browser and access the server.
6169
62- 一、本机访问
70+ ** Local Access **
6371
64- 输入url 。
72+ enter the url 。
6573
6674``` url
6775127.0.0.1:8080
6876```
6977
70- 二、云服务器访问。
78+ ** other machines access **
7179
72- 输入url。
80+ enter the url.
7381
7482``` url
75- (云服务器ip ):8080 # xxx.xxx.xxx.xxx:8080
83+ (server ip ):8080 # xxx.xxx.xxx.xxx:8080
7684```
7785
78- ## 3. 文件结构
86+ ## 3. File Structure
7987
8088``` bash
8189yufc@ALiCentos7:~ /Src/Bit-Project/WebServer-reactor$ tree .
8290.
83- ├── CleanLogs.sh # 清除所有日志文件内容脚本
91+ ├── CleanLogs.sh # Clear all log file content scripts
8492├── Logs
85- │ ├── Requests.log # 收到HTTP报文保存的日志文件
86- │ └── WebServer.log # 服务器打印的日志保存文件
93+ │ ├── Requests.log # Received the log file saved in the HTTP message
94+ │ └── WebServer.log # Server printed log save file
8795├── makefile
88- ├── Reactor # Reactor模式底层服务器文件
96+ ├── Reactor # Reactor pattern underlying server files
8997│ ├── Epoll.hpp
9098│ ├── Log.hpp
9199│ ├── Protocol.hpp
@@ -94,17 +102,17 @@ yufc@ALiCentos7:~/Src/Bit-Project/WebServer-reactor$ tree .
94102├── README.md
95103├── start-main.cc
96104├── text
97- │ └── ziliao.txt # 资料
105+ │ └── ziliao.txt # some Reactor pattern underlying server files
98106├── tools
99- │ ├── main.cc-backup # main函数备份
100- │ └── ulity.hpp # 工具相关接口头文件
101- ├── WebServer # 可执行程序
102- ├── WebServer.hpp # Web服务器头文件
103- ├── wwwroot # 前端根目录
107+ │ ├── main.cc-backup # main function backup
108+ │ └── ulity.hpp # Tool related interface header files
109+ ├── WebServer # executable program
110+ ├── WebServer.hpp # Web server header file
111+ ├── wwwroot # Front end root directory
104112│ ├── error
105113│ │ └── 404.html
106114│ └── index.html
107- └── wwwroot-backup # 前端根目录的一些备份
115+ └── wwwroot-backup # Front end root directory backup
108116 ├── my_blog_root
109117 │ └── index.html
110118 └── wwwroot
@@ -118,13 +126,13 @@ yufc@ALiCentos7:~/Src/Bit-Project/WebServer-reactor$
118126
119127## 4. 项目原理简介
120128
121- 本项目基于Socker编程,采用epoll形式的多路转接,搭建了一个Reactor模式的网络服务器。
129+ This project is based on Docker programming and uses epoll form of multiplexing to build a Reactor mode network server.
122130
123- 其中 ` WebServer.hpp ` 为底层 ` Reactor ` 服务器的封装。
131+ Among them, ' WebServer. hpp' is the encapsulation of the underlying ' Reactor' server.
124132
125- 本项目其实是Nginx服务器的核心所在。
133+ This project is actually the core of Nginx server.
126134
127- 关于Nginx等实现原理,异步IO的原理,多路转接的原理,可以见以下链接。
135+ For the implementation principles of Nginx, asynchronous IO, and multiplexing, please refer to the following links.
128136
129137- ** [ 中文-introduction] ( ./introduction-cn.md ) **
130138
0 commit comments