nginx 在檢查是否可啟動出現問題(cannot open shared objectfile: No such file or directory)的解決
阿新 • • 發佈:2018-11-06
ngnix在檢查是否可啟動的時候,出現下面問題:
(venv) [email protected]:/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) [email protected]:/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) [email protected]:/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) [email protected]:/data/soft/nginx-1.10.2#ln -s /usr/local/lib/libpcre.so.1 /lib/x86_64-linux-gnu/
再次檢查一下nginx的配置檔案
(venv) [email protected] :/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