当前位置: 首页> 汽车> 报价 > 网站制作培训机构_知名的网页制作公司服务好_搜索引擎有哪些种类_杭州优化seo公司

网站制作培训机构_知名的网页制作公司服务好_搜索引擎有哪些种类_杭州优化seo公司

时间:2025/7/9 4:51:32来源:https://blog.csdn.net/weixin_41812346/article/details/146476411 浏览次数: 0次
网站制作培训机构_知名的网页制作公司服务好_搜索引擎有哪些种类_杭州优化seo公司
if (filename) {

 此时 filename=NULL,条件不成立

 else if (cf->conf_file->file.fd != NGX_INVALID_FILE) {type = parse_block;

设置 type,表示当前是在解析一个配置块

    for ( ;; ) {rc = ngx_conf_read_token(cf);

循环读取token

接下来读取的是配置文件 44 行的

root   html

以 ;为结束

 

rc = ngx_conf_handler(cf, rc);

处理 读取的 token

ngx_conf_handler - root html-CSDN博客

 

rc = ngx_conf_read_token(cf);

继续读取 token

接下来 读取的 token是 45 行的

index  index.html index.htm

以 ;为结束

index指令是用来指定当请求指向一个目录时,服务器应该寻找哪些文件作为默认文件

当用户访问一个目录路径(如 http://example.com/ 或 http://example.com/blog/)时,Nginx 会按以下逻辑处理:

  1. 检查目录中是否存在 index 指令指定的文件,按配置顺序依次查找(先 index.html,后 index.htm)。

  2. 返回第一个找到的文件。例如:

    • 若目录中存在 index.html,则直接返回该文件。

    • 若没有 index.html 但存在 index.htm,则返回 index.htm

  3. 若所有文件均未找到,则行为取决于其他配置:

rc = ngx_conf_handler(cf, rc);

处理读取的 token

ngx_conf_handler - index index.html index.htm-CSDN博客

rc = ngx_conf_read_token(cf);

继续读取 token

接下来读入的是 46 行的 }

rc == NGX_CONF_BLOCK_DONE

        if (rc == NGX_CONF_BLOCK_DONE) {if (type != parse_block) {ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");goto failed;}goto done;}
done:if (filename) {if (cf->conf_file->buffer->start) {ngx_free(cf->conf_file->buffer->start);}if (ngx_close_file(fd) == NGX_FILE_ERROR) {ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,ngx_close_file_n " %s failed",filename->data);rc = NGX_ERROR;}cf->conf_file = prev;}if (rc == NGX_ERROR) {return NGX_CONF_ERROR;}return NGX_CONF_OK;

此时 filename=NULL

2个条件都不成立,

返回 NGX_CONF_OK

location 配置块解析完成

 


关键字:网站制作培训机构_知名的网页制作公司服务好_搜索引擎有哪些种类_杭州优化seo公司

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: