ubuntu 升级后运行nginx报错
$ /usr/local/nginx/sbin/nginx: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
从报错内容看是找不到libssl.so.0.9.8
如何解决?
1. 通过ldd查找缺少的库
$ ldd $(which /usr/local/nginx/sbin/nginx)
linux-gate.so.1 => (0xb7773000)
libcrypt.so.1 => /lib/i386-linux-gnu/libcrypt.so.1 (0xb7729000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb76ea000)
libssl.so.0.9.8 => not found
libcrypto.so.0.9.8 => not found
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb76e4000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb76cf000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7553000)
/lib/ld-linux.so.2 (0xb7774000)
2.进入/lib/i386-linux-gnu/ 目录,发现原来是
libssl.so.0.9.8 libcrypto.so.0.9.8 这两个文件升级成
libssl.so.1.0.0 libcrypto.so.1.0.0 导致,
做软链接没办法解决依赖关系,此时最好是重新编译niginx,使用升级后的库。
$ ldd $(which /usr/local/nginx/sbin/nginx)
linux-gate.so.1 => (0xb77b8000)
libcrypt.so.1 => /lib/i386-linux-gnu/libcrypt.so.1 (0xb776e000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb772f000)
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0xb76e1000)
libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0xb753d000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb7528000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73ac000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb73a7000)
/lib/ld-linux.so.2 (0xb77b9000)