nginx http_core模塊 配置文件解析 2

上一篇講述了配置文件的整體結構,下面重點分析htt_core模塊的配置信息結構,得到如下的一幅圖:


從上面很明顯可以看出需要合併的ngx_http_core_srv_conf_t、ngx_http_core_loc_conf_t結構體。但是ngx_http_merge_locations代碼中有:

for (q = ngx_queue_head(locations);
         q != ngx_queue_sentinel(locations);
         q = ngx_queue_next(q))
    {
        lq = (ngx_http_location_queue_t *) q;

        clcf = lq->exact ? lq->exact : lq->inclusive;			//遍歷得到loc_conf_t
        ctx->loc_conf = clcf->loc_conf;

        rv = module->merge_loc_conf(cf, loc_conf[ctx_index],		//當前server塊的loc_conf數組
                                    clcf->loc_conf[ctx_index]);		// == clcf ?(當前server塊下的某個location塊信息)
        if (rv != NGX_CONF_OK) {
            return rv;
        }

        rv = ngx_http_merge_locations(cf, clcf->locations, clcf->loc_conf,		//location 下面還有location麼?
                                      module, ctx_index);
        if (rv != NGX_CONF_OK) {
            return rv;
        }
    }

第二個ngx_http_merge_locations 很明顯是合併location下面的ngx_http_core_loc_conf_t結構體,難道location下面還可以再加location? 這是一個疑問。

於是去網上找資料,有: http://tech.uc.cn/?p=300



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章