Carry の Blog Carry の Blog
首页
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • Python
  • Shell
  • MySQL8-SOP手册
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Carry の Blog

好记性不如烂键盘
首页
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • Python
  • Shell
  • MySQL8-SOP手册
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 工作笔记

  • K8S

  • Systemd

  • Nginx

    • Nginx添加用户认证
    • 利用nginx+sftp实现一个可供用户下载的服务
    • nginx配置文件及模块
    • 通过脚本按天切割nginx的日志
    • nginx通过四层代理实现端口转发
    • NGINX基于cookie针对同一域名进行分流转发
    • nginx利用内置模块配置限速限流
    • 利用NGINX内置模块mirror进行流量复制等操作
    • 使用$remote_user字段记录访问NGINX的用户
    • 从NGINX自身配置文件中定义访问日志按时间切割
    • NGINX配置单独代理百度的sitemap文件
    • nginx配置微信小程序校验及其他
    • nginx配置gzip压缩
    • 由Nginx集中代理分散的PHP集群的实践
    • http状态码详解
    • OpenResty-1-13-6-2-新增ldap模块儿
      • 1,下载相关包
      • 2,安装依赖
      • 3,进行编译
      • 4,配置参考
    • 排查NGINX的open_file_cache导致发布后访问404的问题
    • 制作OpenResty-1-19-9-1的RPM包
    • nginx-proxy-managar使用笔记
    • Nginx 的端口复用:提升服务器并发能力
  • Supervisord

  • OpenLdap

  • OpenVPN

  • GitLab

  • Sshd

  • WebDev

  • Docker

  • Prometheus

  • Rclone

  • Iptables

  • Firewalld

  • Linux笔记
  • Nginx
Carry の Blog
2020-06-06
目录

OpenResty-1-13-6-2-新增ldap模块儿收藏(二丫讲梵)备查

之前在 ldap 的文章里有提到 NGINX 结合 ldap 认证一些公共服务的时候,会非常方便,那么如何将我们需要的 ldap 模块儿添加到部署好了的 openresty 中呢,这篇文章就来讲解一下。

# 1,下载相关包

如果之前安装之后,删除了安装包,现在找不到了,那么可以从如下网站下载与当前一致的版本。

wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
1

下载所需的 ldap 模块儿,项目地址为:https://github.com/kvspb/nginx-auth-ldap.git 考虑到不好下载,于是直接在国内同步了一份。

cd /opt  # 注意拉取代码存放位置
git clone https://gitee.com/eryajf/nginx-auth-ldap.git
1
2

接下来就进入正式的编译安装了。

img

# 2,安装依赖

yum -y install gcc gcc-c++ pcre pcre-devel openldap-devel lua-devel systemtap-sdt-devel openssl-devel openssl
1

# 3,进行编译

需要注意编译并不能在 openresty 根目录进行,否则将会失败。已经有同学在这里踩坑了🤣🤣🤣

tar xf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2/bundle/nginx-1.13.6/
1
2

然后再进行编译:

./configure --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.13 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.5 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre-jit --with-stream --with-stream_ssl_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-file-aio --with-dtrace-probes --with-http_image_filter_module --with-stream --with-stream_ssl_module --with-http_ssl_module --add-module=/opt/nginx-auth-ldap
1

注意如上步骤,如果在一个已经安装过openresty的环境中新增,则需要先把原来的安装包移走,不然下边 make 的时候会报如下错误:

/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libldap.so, may conflict with libssl.so.1.1
/bin/ld: objs/src/event/ngx_event_openssl.o: undefined reference to symbol 'SSL_CTX_get_ex_new_index@@libssl.so.10'
/usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/usr/local/src/openresty-1.13.6.2/bundle/nginx-1.13.6'
make: *** [build] Error 2
1
2
3
4
5
6
7

安装:

make
make install
1
2

安装完成之后,重新软链一下 nginx 的主程序,就可以投入使用了。

ln -snf /usr/local/openresty/nginx/sbin/nginx  /usr/sbin/
1

# 4,配置参考

具体 NGINX 配置 ldap 认证,可以参考如下文章:https://www.ranisa.cn/pages/3416.html#_6-nginx

#openresty#ldap
上次更新: 4/24/2025

← http状态码详解 排查NGINX的open_file_cache导致发布后访问404的问题→

最近更新
01
tidb fast ddl
04-04
02
TiDB配置文件调优 原创
04-03
03
如何移除TiDB中的表分区 原创
04-03
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式