tid=21272&nginx -v 時提示:error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory,意思是找不到libpcre.so.1這個模組,而導致啟動失敗。
9 `2 y2 W* J% Q, B( L4 R6 n要解決這個方法非常容易 如果是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
" a$ `! R, k3 E; m+ P7 c9 L
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
$ Y( y9 j4 _" S2 ?! g1 L, A3 g( Guseradd -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 不建立使用者目錄 & E9 R' o; L% X8 B1 M- _% ?) `! u
vi /etc/passwd 查看是否已新增nginx # k5 R# L; [5 E
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 |