如何包含“ auth_request”模块nginx?

问题描述

由于某种原因,找不到“ auth_request”指令。我正在使用heroku-buildpack-Nginx进行此更改,只是将--with-http_auth_request_module包含在 build_Nginx 脚本中。

Nginx: [emerg] unkNown directive "auth_request" in ./config/Nginx.conf

我的Nginx.conf:

daemon off;
# Heroku dynos have at least 4 cores.
worker_processes <%= ENV['Nginx_WORKERS'] || 4 %>;

events {
    use epoll;
    accept_mutex on;
    worker_connections <%= ENV['Nginx_WORKER_CONNECTIONS'] || 1024 %>;
}

http {
    gzip on;
    gzip_comp_level 2;
    gzip_min_length 512;

    server_tokens off;

    log_format l2met 'measure#Nginx.service=$request_time request_id=$http_x_request_id';
    access_log <%= ENV['Nginx_ACCESS_LOG_PATH'] || 'logs/Nginx/access.log' %> l2met;
    error_log <%= ENV['Nginx_ERROR_LOG_PATH'] || 'logs/Nginx/error.log' %>;

    include mime.types;
    default_type application/octet-stream;
    sendfile on;

    # Must read the body in 5 seconds.
    client_body_timeout 5;

    upstream app_server {
        server unix:/tmp/Nginx.socket fail_timeout=0;
    }

    server {
        listen <%= ENV["PORT"] %>;
        server_name _;
        keepalive_timeout 5;


        location / {
                auth_request /_oauth2_token_introspection;
                proxy_pass https://my-backend;
            }

        location = /_oauth2_token_introspection {
                internal;
                proxy_method      GET;
                proxy_set_header  Authorization "Bearer $token";
                proxy_set_header  Content-Type "application/json";
                proxy_pass        https://{myIDP};
            }
        }
}

我已经将模型添加到./configure --with-http_auth_request_module

# This will build `Nginx`
(
cd Nginx-${Nginx_VERSION}
./configure \
--with-pcre=pcre-${PCRE_VERSION} \
--with-zlib=zlib-${ZLIB_VERSION} \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_auth_request_module \
--prefix=/tmp/Nginx \
--add-module=${temp_dir}/Nginx-${Nginx_VERSION}/headers-more-Nginx-module-${HEADERS_MORE_VERSION} \
--add-module=${temp_dir}/Nginx-${Nginx_VERSION}/Nginx-uuid4-module-${UUID4_VERSION}
make install
)

使用Nginx_VERSION-1.18.0。您能帮我理解为什么找不到此模块吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)