您的位置:首页 > 理论基础 > 计算机网络

nginx http_core模块 配置文件解析 2

2013-03-05 13:56 621 查看
上一篇讲述了配置文件的整体结构,下面重点分析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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: