: This article mainly introduces [nginx source code parsing] configuration parsing (event scope). If you are interested in the PHP Tutorial, refer to it. Process events
The NGX_EVENT_MODULE has two modules: ngx_event_core_module and ngx_epoll_module.
Core code
Ngx_modules [I]-> ctx_index = ngx_event_max_module ++; // set the internal index of the module} ctx = ngx_pcalloc (cf-> pool, sizeof (void *)); if (ctx = NULL) {return NGX_CONF_ERROR;} * ctx = ngx_pcalloc (cf-> pool, ngx_event_max_module * sizeof (void *)); // ctx points to the array if (* ctx = NULL) {return NGX_CONF_ERROR;} * (void **) conf = ctx; for (I = 0; ngx_modules [I]; I ++) {if (ngx_modules [I]-> type! = NGX_EVENT_MODULE) {continue;} m = ngx_modules [I]-> ctx; if (m-> create_conf) {// if the NGX_EVENT_MODULE type module has the create_conf function, call the create_conf function of the module and mount it to the event context (* ctx) [ngx_modules [I]-> ctx_index] = m-> create_conf (cf-> cycle); // create the context if (* ctx) [ngx_modules [I]-> ctx_index] = NULL) {return NGX_CONF_ERROR ;}} pcf = * cf; cf-> ctx = ctx; cf-> module_type = NGX_EVENT_MODULE; // Set the module environment cf-> export _type = NGX_EVENT_CONF; // Set the command type rv = ngx_conf_parse (cf, NULL );
Then parse worker_connections1024. in ngx_event_core_module, call the ngx_event_connections function and set the connect value to 1024. The structure is as follows:
The above introduces [nginx source code parsing] configuration parsing (event scope), including some content, and hopes to be helpful to friends who are interested in PHP tutorials.