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這個模組,而導致啟動失敗。
! j' G+ j6 g7 Z4 X' [! M) m要解決這個方法非常容易 如果是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
9 h; o+ k* w! D0 i
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) A. X6 G4 c( U( a, Q; G! v2 {
useradd -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 不建立使用者目錄
# ^* w9 `0 A& H5 K, k& |
vi /etc/passwd 查看是否已新增nginx ( U6 Q8 H0 y) f4 o1 P% |/ r
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 |