zoukankan      html  css  js  c++  java
  • ngxin 添加模块

    if test -n "$NGX_ADDONS"; then
    
        echo configuring additional modules
    
        for ngx_addon_dir in $NGX_ADDONS
        do  
            echo "adding module in $ngx_addon_dir"
    
            if test -f $ngx_addon_dir/config; then
                . $ngx_addon_dir/config
    
                echo " + $ngx_addon_name was configured"
    
            else
                echo "$0: error: no $ngx_addon_dir/config was found"
                exit 1
            fi  
        done
    fi

    ./configure 文件中对自定义模块的处理

    ngx_addon_name=ngx_http_mytest_module
    HTTP_MODULES="$HTTP_MODULES ngx_http_mytest_module"
    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_mytest_module.c"

    增加一个自定义模块的config文件实例

    if [ $HTTP = YES ]; then
        modules="$modules $HTTP_MODULES $HTTP_FILTER_MODULES 
                 $HTTP_HEADERS_FILTER_MODULE 
                 $HTTP_AUX_FILTER_MODULES 
                 $HTTP_COPY_FILTER_MODULE 
                 $HTTP_RANGE_BODY_FILTER_MODULE 
                 $HTTP_NOT_MODIFIED_FILTER_MODULE"
    
        NGX_ADDON_DEPS="$NGX_ADDON_DEPS $(HTTP_DEPS)"
    fi

    模块在 ngx_modules.c中的顺序

    ngx_modules 是非常关键的数组,它指明了每个模块在Nginx中的优先级,当一个请求同时符合多个模块的处理规则时,将按照数组中的顺序选择最靠前的模块优先处理。对于HTTP过滤模块而言则是相反的,因为HTTP框架在初始化时,会在ngx_modules数组中将过滤模块按先后顺序向过滤链表中添加,但每次都是添加到链表的表头,因此,对HTTP过滤模块而言,在ngx_modules数组中越靠后的模块反而会首先处理HTTP响应。因此ngx_modules中模块的先后顺序非常重要,不正确的顺序会导致Nginx无法正常工作!

  • 相关阅读:
    blob2clob/clob2blob研究
    dbms_lob使用之-基础
    xml特殊字符处理 如&
    错误:One or more post-processing actions failed. Consult the OPP service log for details
    Oracle dblink详解
    iOS 屏幕方向
    一种自动(半自动)学习的算法(验证码识别)
    图像相似度计算
    simHash 简介以及java实现
    一个算法博客
  • 原文地址:https://www.cnblogs.com/andyhe/p/3386244.html
Copyright © 2011-2022 走看看