./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such

This error message indicates that nginx cannot find the libpcre.so.1 shared library file at runtime, which may be caused by the fact that the PCRE library is not installed in the system or the version of the installed PCRE library is incorrect.

The solution is as follows:

  1. To confirm whether the PCRE library has been installed in the system, you can use the command rpm -qa | grep pcreto query. If not installed, you need to install the PCRE library first.

  2. If the PCRE library is already installed, the problem may be caused by a version mismatch. You can try to recompile and install the PCRE library, and install it to the system default path (usually /usr/local/lib).

  3. If the PCRE library has been installed and the version is correct, but nginx still cannot find the libpcre.so.1 file, you can try to add the directory where the PCRE library is located to the system's shared library search path. You can add the directory where the PCRE library is located to the /etc/ld.so.conf file, and execute the command ldconfigto update the shared library cache so that the system can find the library file.

For example, assuming the PCRE library is installed in /usr/local/lib, you can proceed as follows:

echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

After performing the above operations, restarting nginx should not cause the problem that the libpcre.so.1 file cannot be found.

/usr/local/nginx/sbin/nginx

Guess you like

Origin blog.csdn.net/weixin_71921932/article/details/129794958