[root@linuxidc lib64]# service nginx start
Starting nginx: [ OK ]
[root@linuxidc lib64]#
8、启动报错处理
[root@linuxidc init.d]# service nginx start
Starting nginx: /usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[FAILED]
使用ldd看nginx包含的动态函式库
[root@linuxidc src]# ldd $(which /usr/local/nginx/sbin/nginx)
linux-vdso.so.1 => (0x00007fff89fff000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003978400000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x000000397b800000)
libpcre.so.1 => not found
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007ffd9a115000)
libz.so.1 => /lib64/libz.so.1 (0x0000003977c00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003978000000)
/lib64/ld-linux-x86-64.so.2 (0x0000003977800000)
libfreebl3.so => /lib64/libfreebl3.so (0x000000397ac00000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003978800000)
[root@linuxidc src]# cd /
可以看到 libpcre.so.1 => not found
解决方法:
进入/lib64目录中手动链接下
[root@linuxidc init.d]# cd /lib64/
[root@linuxidc lib64]# ln -s libpcre.so.0.0.1 libpcre.so.1
然后再启动。
更多Nginx相关教程见以下内容:
CentOS 6.2实战部署Nginx+MySQL+PHP
搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程
CentOS 6.3下配置Nginx加载ngx_pagespeed模块