nginx_request_conf_finding

Overview

each request is served by a virtual server, then based on uri, select the right location, hence each request has related main_conf, srv_conf, loc_conf that hold config, based on config select proper parameters to process the request.

request conf ctx

request conf finding

Data Structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
struct ngx_http_request_s {
ngx_connection_t *connection;
void **main_conf;
void **srv_conf;
void **loc_conf;
...
}

typedef struct {
void **main_conf;
void **srv_conf;
void **loc_conf;
} ngx_http_conf_ctx_t;

typedef struct {
/* conf ctx like main/srv/loc conf, comes from default virtual server */
ngx_http_conf_ctx_t *conf_ctx;
} ngx_http_connection_t;

typedef struct {
/* server ctx */
ngx_http_conf_ctx_t *ctx;
...
} ngx_http_core_srv_conf_t;