nginx -v 時提示:error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory,意思是找不到libpcre.so.1這個模組,而導致啟動失敗。
! g& N5 X2 y, x ~" B) U5 ?, P要解決這個方法非常容易 如果是32位系统 [root@lee ~]# ln -s /usr/local/lib/libpcre.so.1 /lib 如果是64位系统 [root@lee ~]# ln -s /usr/local/lib/libpcre.so.1 /lib64 然後再啟動nginx就OK了 [root@lee ~]# service nginx start 3 B$ M% T& k- E" n0 t) ^
BUT service nginx start show error: nginx: unrecognized service Solution: 原因是找不到啟動的script 及 可執行檔 cp /usr/sbin/nginx /etc/init.d/ nginx是執行檔 複製別台server 之 /etc/rc.d/init.d/nginx 到 本機 /etc/rc.d/init.d/nginx 此處nginx 是啟動的script 再一次 service nginx start show error: Starting nginx: nginx: [emerg] getpwnam("nginx") failed in /etc/nginx/nginx.conf:2 原因是沒有 nginx 用戶及群組 Sol: groupadd -r nginx
: w/ f! q8 a3 l& \9 L6 huseradd -r -g nginx -s /bin/false -M nginx or /usr/sbin/groupadd -f nginx /usr/sbin/useradd -M -s /sbin/nologin -g nginx nginx //-M 不建立使用者目錄 6 G# v7 ~4 \0 X4 a$ b9 s
vi /etc/passwd 查看是否已新增nginx 4 i% W( i0 Y" J8 s3 [
again service nginx start show error: Starting nginx: nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (2: No such file or directory) Sol: 查無 /var/cache/nginx/ 此目錄 mkdir /var/cache/nginx again service nginx start ======ok |