ubuntu14 编译安装了nginx ,貌似一切正常,但是启动时报错:
error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
找不到pcre库,这个库在 /usr/local/lib 目录,执行:
export LD_LIBRARY_PATH=/usr/local/lib/
也还是不行,谷歌,翻到一篇文章:
出现这个问题可能有以下原因:
- 没有安装 pcre 库
- nginx 编译安装时没有指定正确的pcre 地址
- pcre 库没有加入到
LD_LIBRARY_PATH
我自己是第二种原因,所以重新编译安装nginx并指定pcre:
./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.38
make
sudo make install
就可以了~
参考: