@@ -5,58 +5,59 @@ echo string
5
5
6
6
## Nginx Version
7
7
Nginx1.0.10 https://github.com/nginx/nginx/releases/tag/release-1.0.10
8
- ![ image ] ( https://wx1.sinaimg.cn/large/005LOzcmly1fgimmvpk3sj30mi04p3z9.jpg )
8
+ ![ nginx1.0.10.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc07b90e28.png )
9
9
10
10
## The development environment configuration
11
11
``` shell
12
12
OS : CentOS Linux release 7.2.1511 (Core)
13
13
```
14
- ![ image ] ( https://wx4.sinaimg.cn/large/005LOzcmly1fgimnlvhh0j30s106imxw.jpg )
15
- ![ image ] ( https://wx4.sinaimg.cn/large/005LOzcmly1fgimnlwy1fj315u0dwdhn.jpg )
14
+ ![ Server_info.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc07b5dff4.png )
15
+ ![ Server_CPU_info.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc0825053e.png )
16
16
17
17
## Install a clean compile Nginx
18
18
1 . Download a Nginx10.10 and unpack it
19
- ![ image ] ( http ://wx2.sinaimg.cn/large/005LOzcmly1fgimq77ahwj30pw05et9n.jpg )
19
+ ![ nginx1.0.10.png ] ( https ://ooo.0o0.ooo/2017/06/13/593fc07cd07e2.png )
20
20
21
21
2 . Install the GCC and the lib Nginx need
22
- ![ image ] ( https://wx4.sinaimg.cn/large/005LOzcmly1fgimv0hryoj30pd06djs8.jpg )
23
- ![ image ] ( https://wx4.sinaimg.cn/large/005LOzcmly1fgimva84bbj30pa07fgms.jpg )
22
+ ![ install_GCC.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc06152dd0.png )
23
+ ![ Nginx_lib.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc078c3c2b.png )
24
24
25
25
3 . ./configure --prefix=/usr/local/nginx && make && make install
26
- ![ image] ( https://ws2.sinaimg.cn/large/005LOzcmly1fgimvz2rfkj30j10av75w.jpg )
27
- ![ image] ( https://wx2.sinaimg.cn/large/005LOzcmly1fgimw6cmh2j30ur06n757.jpg )
28
- ![ image] ( https://ws4.sinaimg.cn/large/005LOzcmly1fgimwezp9tj30qu0fdn0a.jpg )
26
+ ![ configure_ok.png] ( https://ooo.0o0.ooo/2017/06/13/593fc061b5a9f.png )
27
+ ![ make && make install.png] ( https://ooo.0o0.ooo/2017/06/13/593fc074c9b29.png )
28
+ ![ nginx_install_ok.png] ( https://ooo.0o0.ooo/2017/06/13/593fc080db608.png )
29
+
29
30
4 . Nginx run
30
- ![ image ] ( https://wx3.sinaimg.cn/large/005LOzcmly1fgimy3dkk5j30rr05ddh5.jpg )
31
- ![ image ] ( https://ws1.sinaimg.cn/large/005LOzcmly1fgimyc58d3j31vk0qsq9y.jpg )
31
+ ![ start_nginx.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc08044567.png )
32
+ ![ nginx_install_ok.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc080db608.png )
32
33
33
34
## Definition module configuration structure
34
35
``` C
35
36
typedef struct {
36
37
ngx_str_t ed; //该结构体定义在这里 https://github.com/nginx/nginx/blob/master/src/core/ngx_string.h
37
38
} ngx_http_echo_loc_conf_t ;
38
39
```
39
- ![ image ] ( https://wx2.sinaimg.cn/large/005LOzcmly1fgin4at3rsj30rp04g74r.jpg )
40
+ ![ define_moudle_conf.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc0615456f.png )
40
41
41
- #Define Nginx instruction and parameter conversion function
42
- ![ image ] ( https://wx1.sinaimg.cn/large/005LOzcmly1fgjdis37udj30xj0bktan.jpg )
42
+ ## Define Nginx instruction and parameter conversion function
43
+ ![ 定义指令和参数转化函数.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc0529132f.png )
43
44
44
45
## definition module Context
45
46
1 . Define the type of ngx_http_module_t structure variables
46
- ![ image ] ( https://wx3.sinaimg.cn/large/005LOzcmly1fgjer4wtrxj313u09igo7.jpg )
47
+ ![ 定义注入点结构体.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc052953a4.png )
47
48
2 . Initialize a configuration structure
48
- ![ image ] ( https://wx1.sinaimg.cn/large/005LOzcmly1fgjerqnq71j30zd08fmyd.jpg )
49
+ ![ 初始化一个配置结构体.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc05277601.png )
49
50
3 . Will the father block configuration information incorporated into this structure Implement the configuration of inheritance
50
- ![ image ] ( https://wx3.sinaimg.cn/large/005LOzcmly1fgjes12fy5j30ya08qgn7.jpg )
51
+ ![ 合并父block的配置信息.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc0528ec4a.png )
51
52
52
53
## Write the Handler really work part of the module
53
- ![ image ] ( https://ws2.sinaimg.cn/large/005LOzcmly1fgjfosnvf5j31hy0q6wlb.jpg )
54
+ ![ Nginx模块handler.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc0616a385.png )
54
55
55
56
## Combination Nginx module
56
- ![ image ] ( https://ws2.sinaimg.cn/large/005LOzcmly1fgjjo2l11jj31en0g4gq1.jpg )
57
+ ![ 组合Nginx Module.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc052aa29a.png )
57
58
58
59
## Finishing module code According to the Nginx official specification
59
- ![ image ] ( https://ws2.sinaimg.cn/large/005LOzcmly1fgjnxy9ikvj31yx12jwr3.jpg )
60
+ ![ ok_file.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc061b7d7a.png )
60
61
61
62
## Write the config file
62
63
``` shell
@@ -69,18 +70,19 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_echo_module.c"
69
70
./configure --prefix=/usr/local/nginx/ --add-module=/root/ngx_dev && make && make install
70
71
```
71
72
## Successful installation
72
- ![ image ] ( https://ws3.sinaimg.cn/large/005LOzcmly1fgjnvxyqx4j30w40f0tbw.jpg )
73
+ ![ make install.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc052be07d.png )
73
74
74
75
## Modify the Nginx configuration file test Module
75
- ![ image ] ( https://ws2.sinaimg.cn/large/005LOzcmly1fgjnz17rh7j30jl07yaai.jpg )
76
+ ![ test module.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc0614f91a.png )
76
77
77
78
## Nginx echo Module The successful running
78
- ![ image ] ( https://ws2.sinaimg.cn/large/005LOzcmly1fgjo0r1a5dj30yf06tmxv.jpg )
79
+ ![ module ok.png ] ( https://ooo.0o0.ooo/2017/06/13/593fc05292b08.png )
79
80
80
81
# If the repo help you welcome star fork Thanks!
81
82
82
83
> ## reference
83
84
> 1 . http://wiki.nginx.org/Configuration
84
85
> 2 . http://tengine.taobao.org/book/
85
86
> 3 . ** http://blog.codinglabs.org/articles/intro-of-nginx-module-development.html **
86
- > 4 . https://www.nginx.com/resources/wiki/modules/
87
+ > 4 . https://www.nginx.com/resources/wiki/modules/
88
+
0 commit comments