nginx 在检查是否可启动出现问题(cannot open shared objectfile: No such file or directory)的解决

版权声明:未经本人同意不得转载! https://blog.csdn.net/yanpenggong/article/details/83617932

ngnix在检查是否可启动的时候,出现下面问题:

(venv) root@instance-nl5v4j4n:/data/server/nginx#./sbin/nginx -t
    ./sbin/nginx:error while loading shared libraries: libpcre.so.1: cannot open shared objectfile: No such file or directory

分析:

1、先看报错
2、思考,是否报错真实有效
	分析: 谁错了
3、查找文件
	全名找不到,我们使用正则
4、找到文件,我没有问题
	nginx默认找库文件的路径有问题
5、解决

解决:

(venv) root@instance-nl5v4j4n:/data/soft/nginx-1.10.2#ldd /data/server/nginx/sbin/nginx 
        linux-vdso.so.1 =>  (0x00007ffdb9154000)
        libdl.so.2 =>/lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa59379b000)
        libpthread.so.0 =>/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa59357e000)
        libcrypt.so.1 =>/lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fa593345000)
        libpcre.so.1 => not found
        libc.so.6 =>/lib/x86_64-linux-gnu/libc.so.6 (0x00007fa592f7c000)
        /lib64/ld-linux-x86-64.so.2(0x0000564bfef41000)

查找文件:

(venv) root@instance-nl5v4j4n:/data/soft/nginx-1.10.2#find / -name "libpcre.so.1"
/data/soft/pcre-8.39/.libs/libpcre.so.1
/usr/local/lib/libpcre.so.1
...

链接该文件

(venv) root@instance-nl5v4j4n:/data/soft/nginx-1.10.2#ln -s /usr/local/lib/libpcre.so.1 /lib/x86_64-linux-gnu/

再次检查一下nginx的配置文件

(venv) root@instance-nl5v4j4n:/data/soft/nginx-1.10.2#/data/server/nginx/sbin/nginx -t

nginx:the configuration file /data/server/nginx/conf/nginx.conf syntax is ok

nginx:configuration file /data/server/nginx/conf/nginx.conf test is successful

猜你喜欢

转载自blog.csdn.net/yanpenggong/article/details/83617932
今日推荐