AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 988250
Accepted
user153991
user153991
Asked: 2019-10-17 05:37:53 +0800 CST2019-10-17 05:37:53 +0800 CST 2019-10-17 05:37:53 +0800 CST

Nginx 模块在 Centos 7 上编译后二进制不兼容

  • 772

我需要在 Centos 7 服务器上使用 Nginx 模块ngx_http_auth_pam_module 。由于一个包只能通过 getpagespeed 存储库获得,这不是免费的,我想自己编译它。

按照我找到的各种说明,我下载了模块和 Nginx 的源代码,列出了使用 安装的 Nginx 版本的编译选项,然后使用thennginx -V编译模块,安装了一些包来修复过程中的各种错误。./configuremake modules

但是,当我尝试将 Nginx 配置为使用新编译的模块时,nginx -t给了我nginx: [emerg] module "/opt/nginx/modules/ngx_http_auth_pam_module.so" is not binary compatible in /usr/share/nginx/modules/mod-http-auth-pam.conf:1

根据我的阅读,这个“不兼容二进制”错误是由于安装的 Nginx 版本与模块中的不同编译标志造成的,但是我确保复制所有由nginx -V. 我还确保下载与安装的 Nginx 相同版本的源代码。

知道可能导致问题的原因吗?我应该卸载 Nginx 并重新安装编译版本,还是有它自己的问题?

附录 :

这是整个./configure命令:

./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --with-compat --add-dynamic-module=../ngx_http_auth_pam_module/

在这里nginx -V

nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
nginx
  • 4 4 个回答
  • 9352 Views

4 个回答

  • Voted
  1. Best Answer
    user153991
    2019-10-17T07:12:56+08:002019-10-17T07:12:56+08:00

    事实证明,该--with-compat选项导致了问题。我添加它是因为 nginx.com 上的指南是这样说的,但是在删除它并再次编译后,nginx -t告诉我配置很好。

    • 5
  2. Danila Vershinin
    2019-10-27T04:57:53+08:002019-10-27T04:57:53+08:00

    删除--with-compat选项不可能解决它。

    如果您收到有关使用此选项编译的二进制不兼容模块的错误,则仅表示您将其编译为一个版本并加载到另一个版本中。例如,当您在 NGINX 1.12.2 中加载(使用)模块时,模块是针对 NGINX 源 1.16.0 编译的。顺便说一下,那个版本很旧,并且有 HTTP/2 安全漏洞,你必须更新.

    如果有的话,没有太多理由不使用--with-compat.

    我很偏向于这样说,但是 GetPageSpeed 存储库虽然对 CentOS 7 不是免费的(在撰写本文时对 CentOS/RHEL 8 是免费的),但它允许您始终获得新 NGINX 版本的最新模块,这些模块是定期发布并解决新的安全问题以及添加的功能。否则,您必须不断地重新编译模块而不是 . yum update,并且可能最终在生产系统上使用编译软件。这本身就是一个安全问题。

    GetPageSpeed 替代方案是订阅 NGINX Plus,其成本远远超过几美元。

    • 1
  3. clarkttfu
    2020-06-12T01:49:24+08:002020-06-12T01:49:24+08:00

    更兼容的方式:

    1. 通过以下方式找出当前的 nginx 实例版本nginx -v
    2. 克隆 nginx 源代码并签出该标签,例如“release-1.18.0”。
    3. 通过以下方式使用完全相同的选项配置源:
    auto/configure --add-dynamic-module=/path/to/your/module `nginx -V`
    
    1. 制作
    • 1
  4. david
    2020-12-27T19:36:55+08:002020-12-27T19:36:55+08:00

    要在 nginx 上启用兼容模块,请在编译配置和 nginx 安装中创建动态模块之前尝试使用 --with-compat。这是我的nginx安装:

    1. ./configure --prefix=/opt/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module -- with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-pcre --with-debug --with-http_stub_status_module --with-openssl --with-compat
    2. 制作
    3. 进行安装

    并尝试创建您的动态模块并从 nginx.conf 加载它。

    高温高压

    • -2

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve