现在的位置: 首页 > 综合 > 正文

nginx http_core模块 配置文件解析 2

2013年09月09日 ⁄ 综合 ⁄ 共 790字 ⁄ 字号 评论关闭

上一篇讲述了配置文件的整体结构,下面重点分析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

抱歉!评论已关闭.