Get the App
SLTechnology News&Howtos  ›  Servers  › 

Nginx compiles and installs version 1.17.3, adding openssl parameters to solve the problem of error reporting

Shulou Source: shulou.com Published: 2022-06-02 11:33:29 09月21日 Update

Background

Recently, when upgrading nginx1.14.1 to nginx1.17.3 version, I found an error in openssl. Record the occurrence of the problem and the process of solving it for your reference.

problem

When upgrading nginx, I used the compilation parameters of the original version to compile the new version 1.17.3 as follows:

# / usr/local/nginx/sbin/nginx-V get compilation parameters:-- prefix=/usr/local/nginx-- with-http_ssl_module-- with-openssl=/usr/local/openssl-- with-http_stub_status_module-- with-http_dav_module-- with-http_realip_module-- with-http_gzip_static_module-- with-http_v2_module

When compiling the new version of nginx,make with the compilation parameters of the old version, an error was found. The operation and information are as follows:

# tar-zxvf nginx-1.17.3.tar.gz# cd nginx-1.17.3#. / configure-- prefix=/usr/local/nginx-- with-http_ssl_module-- with-openssl=/usr/local/openssl-- with-http_stub_status_module-- with-http_dav_module-- with-http_realip_module-- with-http_gzip_static_module-- with-http_v2_module# makemake-f objs/Makefilemake [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 directorymake [1]: * * [/ usr/local/openssl/.openssl/include/openssl/ssl.h] Error 127make [1]: Leaving directory `

From the error message, you can see that the compilation is caused by the error of the openssl-related component, which may be caused by the parameter "--with-openssl=/usr/local/openssl". The file "/ usr/local/openssl/.openssl/include/openssl/ssl.h" is mentioned here. I tried to find this file and found that it couldn't be found: (/ usr/local/openssl is my own installation of openssl)

# ll / usr/local/openssl/.openssl/ls: cannot access / usr/local/openssl/.openssl/: No such file or directory

It can be found that the .openssl directory itself does not exist. It should be that nginx version 1.17.3 went to the "/ usr/local/openssl/.openssl/" directory by default when compiling, which led to the failure of make.

Solve

After discovering the possible cause of the problem, try to modify the relevant compilation information (auto/lib/openssl/conf) when nginx1.17.3 adds the openssl module:

# vi auto/lib/openssl/conf CORE_INCS= "$CORE_INCS $OPENSSL/.openssl/include" CORE_DEPS= "$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h" CORE_LIBS= "$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a" CORE_LIBS= "$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a" / / in this file, see the core related directory of openssl The directory .openssl has been added. Try to modify the directory information and remove the directory .openssl: # more auto/lib/open/ssl CORE_INCS= "$CORE_INCS $OPENSSL/include" CORE_DEPS= "$CORE_DEPS $OPENSSL/include/openssl/ssl.h" CORE_LIBS= "$CORE_LIBS $OPENSSL/lib/libssl.a" CORE_LIBS= "$CORE_LIBS $OPENSSL/lib/libcrypto.a"

After modifying the information of auto/lib/openssl/conf, recompile and install nginx1.17.3, and you can compile and install successfully.

# make clean#. / configure-- prefix=/usr/local/nginx-- with-http_ssl_module-- with-openssl=/usr/local/openssl-- with-http_stub_status_module-- with-http_dav_module-- with-http_realip_module-- with-http_gzip_static_module-- with-http_v2_module# make & & make install

Tags: Compile directory information parameters version file problem time attempt upgrade success reason convention module component background procedure error reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn macOS Shulou Information Apple