[Nginx source code parsing] configuration parsing (event scope)

Source: Internet
Author: User
: 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.