Nginx服务器中的模块编写及相关内核源码初探

2019-10-17 19:58:56刘景俊

 

这里只有每个模块变量的声明,并且每个模块的定义都包含在自己的模块文件当中,比如ngx_core_module定义在src/core/nginx.c中:

ngx_module_t ngx_core_module = { 
 NGX_MODULE_V1, 
 &ngx_core_module_ctx,     /* module context */ 
 ngx_core_commands,      /* module directives */ 
 NGX_CORE_MODULE,      /* module type */ 
 NULL,         /* init master */ 
 NULL,         /* init module */ 
 NULL,         /* init process */ 
 NULL,         /* init thread */ 
 NULL,         /* exit thread */ 
 NULL,         /* exit process */ 
 NULL,         /* exit master */ 
 NGX_MODULE_V1_PADDING 
}; 

是不是跟helloworld里面非常相似了,没错,他们都是模块,唯一的不同点就是helloworld是你另外加进去的。
到现在位置也只是初探nginx的模块,最后提一张别人画的nginx的模块图,有助于接下来的学习。