这里分析的很详细[fn:1] 当前worker的数量为配置的7/8以上时会set: ngx_accept_disabled
key function:
ngx_http_process_request_line -> ngx_http_read_request_header -> ngx_http_parse_request_line htt parser -> ngx_http_parse_header_line
ngx_http_headers_in header -> process function map e.g.
ngx_http_header_t ngx_http_headers_in[] = {
{ ngx_string("Host"), offsetof(ngx_http_headers_in_t, host),
ngx_http_process_host },
{ ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection),
ngx_http_process_connection },
...
...
when is header process done? ==> NGX_HTTP_PARSE_HEADER_DONE, (two \n\n indicate header finish)
if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
...
ngx_http_process_request(r);
...
}
ngx_http_process_request detail:
c->read->handler = ngx_http_request_handler;
c->write->handler = ngx_http_request_handler;
r->read_event_handler = ngx_http_block_reading;
final http process function:
ngx_http_core_run_phases
ngx_worker_process_cycle -> ngx_process_events_and_timers
-v Print version. -V Print NGINX version, compiler version and configure parameters. -t Don’t run, just test the configuration file. NGINX checks configuration for correct syntax and then try to open files referred in configuration. -q Suppress non-error messages during configuration testing. -s signal Send signal to a master process: stop, quit, reopen, reload. (version >= 0.7.53) -p prefix Set prefix path (default: usr/local/nginx). (version >= 0.7.53) -c filename Specify which configuration file NGINX should use instead of the default. -g directives Set global directives. (version >= 0.7.4)
[fn:1] http://blog.csdn.net/russell_tao/article/details/7204260