ruby - 如何包含“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。你能帮我理解为什么找不到这个模块吗?
解决方案
推荐阅读
- javascript - 如何在点击时显示 Bootstrap 行?
- ios - _PFObjectIDFastHash64 崩溃 EXC_BAD_ACCESS KERN_INVALID_ADDRESS
- f# - 如何在刺猬中定义一个生成特定长度列表的生成器?
- javascript - 'classList' 为空
- android - 当可见性消失时,ImageButton 会跳转
- algorithm - 在浮点数数组中找到一个三元组,它们的总和为 [1.0, 2.0] 中的一个值
- java - 如何使 JButton 宽度变小?
- vue.js - 使用 vue2-google-maps 应用基于云的地图样式?
- ios - 手动呈现 PHPickerViewController 时如何显示当前选定的照片?
- python - 在 Python 中动态获取两个或多个索引之间的元素,无需硬编码索引变量的数量