【问题标题】:http_ssl_module failed to install when compile from source code of nginx从 nginx 的源代码编译时,http_ssl_module 安装失败
【发布时间】:2021-11-13 12:47:45
【问题描述】:

我正在尝试使用 certbot 设置我的 https,所以我需要重新编译 ngx 添加“--with-http_ssl_module”,这里是完整的步骤:

 - sudo make clean 
 - sudo  ./auto/configure --prefix=/var/www/html --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --with-pcre --with-http_ssl_module  --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --modules-path=/etc/nginx/modules
 - check Makefile , I can see 'http_ssl_module' added in objs/Makefile  
 - sudo make 
 - sudo make install

完成上述所有步骤后(未观察到错误) 我检查了 'ngx_modules.o'(仍然缺少 ssl 模块) 并在下面运行命令

sudo certbot --nginx -d feedme.pub 
Saving debug log to /var/log/letsencrypt/letsencrypt.log 
The nginx plugin is not working; there may be problems with your existing configuration. 
The error was: PluginError('Nginx build is missing SSL module (--with-http_ssl_module).') 

另外,我检查了我的 ssl 库 - libssl 已安装:

ldconfig -p | grep libssl
    libssl3.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl3.so
    libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
    libssl.so.1.0.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
    libssl.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so

任何人都可以帮助回答为什么我无法在 '--with-http_ssl_module' 中构建'--with-http_ssl_module'?

【问题讨论】:

    标签: ubuntu nginx ssl certbot


    【解决方案1】:

    解决办法如下:

    1. 在 ./configration 步骤中添加 --with-openssl=/usr/include/openssl' options ,因为 '--with-http_ssl_module' 需要使用 openssl
    2. 构建时出现另一个错误:
    make -f objs/Makefile
    make[1]: Entering directory `/root/soft/nginx-1.17.3'
    cd /usr/local/openssl \
    && if [ -f Makefile ]; then make clean; fi \
    && ./config --prefix=/usr/local/openssl/.openssl no-shared no-threads  \
    && make \
    && make install_sw LIBDIR=lib
    /bin/sh: line 2: ./config: No such file or directory
    make[1]: *** [/usr/local/openssl/.openssl/include/openssl/ssl.h] Error 127  make[1]: Leaving directory `
    

    我做的是手动修改

    ./auto/lib/openssl/conf
    

    将下面的路径更改为我的 ubuntu 上的实际位置

        CORE_INCS="$CORE_INCS <your openssl lib's path>/include"
        CORE_DEPS="$CORE_DEPS <your openssl lib's path>/include/openssl/ssl.h"
        CORE_LIBS="$CORE_LIBS <your local libssl.a path>/lib/libssl.a"
        CORE_LIBS="$CORE_LIBS <your local libcrypto.a path>/lib/libcrypto.a"
    

    然后运行 ​​make ,一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-23
      • 1970-01-01
      • 2012-07-07
      • 2015-02-06
      • 1970-01-01
      • 1970-01-01
      • 2016-01-01
      • 2021-12-28
      相关资源
      最近更新 更多