nginx检查报错 error while loading shared libraries: libprofiler.so.0: cannot open shared object file

在centos7.3上编译安装nginx 启动测试出错

[root@web02 local]# /usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libprofiler.so.0: cannot open shared object file: No such file or directory

从错误看出是缺少lib文件导致,进一步查看下 

[root@web02 local]# ldd $(which /usr/local/nginx/sbin/nginx)
	linux-vdso.so.1 =>  (0x00007ffdd918e000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fea2b1c8000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fea2afac000)
	libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fea2ad74000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fea2ab12000)
	libssl.so.10 => /lib64/libssl.so.10 (0x00007fea2a8a0000)
	libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fea2a43e000)
	libz.so.1 => /lib64/libz.so.1 (0x00007fea2a228000)
	libgd.so.2 => /lib64/libgd.so.2 (0x00007fea29fe1000)
	libprofiler.so.0 => not found
	libc.so.6 => /lib64/libc.so.6 (0x00007fea29c1d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fea2b3d6000)
	libfreebl3.so => /lib64/libfreebl3.so (0x00007fea29a1a000)
	libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fea297cc000)
	libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fea294e4000)
	libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fea292e0000)
	libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fea290ac000)
	libXpm.so.4 => /lib64/libXpm.so.4 (0x00007fea28e9a000)
	libX11.so.6 => /lib64/libX11.so.6 (0x00007fea28b5c000)
	libjpeg.so.62 => /lib64/libjpeg.so.62 (0x00007fea28906000)
	libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007fea286c9000)
	libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007fea28423000)
	libpng15.so.15 => /lib64/libpng15.so.15 (0x00007fea281f7000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fea27ef5000)
	libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fea27ce7000)
	libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fea27ae2000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fea278c8000)
	libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fea2769f000)
	libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fea27475000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fea2724e000)
	libXau.so.6 => /lib64/libXau.so.6 (0x00007fea27049000)  

可以看出libprofiler.so.0并没有找到 找出源文件

find / -type f -name "libprofiler.so*" 

做软连接

ln -sv /usr/local/lib/libprofiler.so.0.4.17 /lib64/libprofiler.so.0

再次检查

/usr/local/nginx/sbin/nginx -t