52AV手機A片王|52AV.ONE

標題: Nginx + PHP-Fpm [打印本頁]

作者: IT_man    時間: 2015-1-11 00:18
標題: Nginx + PHP-Fpm
《1》安裝nginx
" n$ I3 f7 z# k5 y5 J6 A yum install nginx8 q. `: Q5 \3 L$ N
........... g3 d+ A! y& Y
Running Transaction8 e# S5 ?/ ]2 h# x0 f
  Installing : GeoIP-1.5.1-5.el6.x86_64                                               1/3
/ Q/ I" s4 L: c. Z$ i  Installing : nginx-filesystem-1.0.15-11.el6.noarch                                  2/3
. s% U/ l: X7 \* J7 y, m  Installing : nginx-1.0.15-11.el6.x86_64                                             3/3) n) ?: H' @9 y) I5 V2 Q+ c
  Verifying  : nginx-filesystem-1.0.15-11.el6.noarch                                  1/3/ s! u) J1 R3 d( l$ P5 v; s
  Verifying  : nginx-1.0.15-11.el6.x86_64                                             2/3+ f, p0 W. A# [  A! Y
  Verifying  : GeoIP-1.5.1-5.el6.x86_64                                               3/3' ]% |* c+ d$ U* i. p4 }$ N; Q

8 x9 z" c/ F5 f6 VInstalled:# q& d  \$ J# x+ q
  nginx.x86_64 0:1.0.15-11.el6
& o, n! Y! U+ @! [# B4 D2 \Dependency Installed:' {* n. g' M( R& f
  GeoIP.x86_64 0:1.5.1-5.el6            nginx-filesystem.noarch 0:1.0.15-11.el6
: Y' A- T6 i( vComplete!3 h# W8 H: y- ?. X( u- J
; \2 k( S; B" u6 B3 Z
設定/etc/nginx/nginx.conf
$ J' ^" u  o* L9 \

4 e# M4 v, f3 G* |& r% k! f* h0 G. h& _! S
《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html
8 B" T" _) f& b' s6 Z! y設定 /etc/php-fpm.d/www.conf  user and group  = nginx (default  apache)  ==> still error
/ }4 j- n, h# \6 p; A4 l, R  F5 Z2 D1 B1 m* Q+ S8 s$ |
啟動php-fpm service php-fpm start  k' I$ n% |  @, ~1 y* q
啟動nginx      
service nginx start
" I/ S3 a8 l! ~
結果8 s$ T. y+ f0 T
出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
4 \/ I. E7 a/ \; u" T5 H
解決# K  f, m4 _! b: K
先找libgd.so.2 在何處(locate libgd.so.2*)
結果在/usr/lib64/libgd.backup所以cp /usr/lib64/libgd.backup/libgd.so.2*  /usr/lib64( G2 ^' a+ l% N. Y+ J8 A8 L
再一次啟動nginx
service nginx start6 e* Z4 d/ r- `
結果nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:46- D" G9 g# J% M8 d
先查看nginx 的configure /usr/sbin/nginx -V
1 E! F9 A( v  T2 C: h2 Unginx version: nginx/1.0.15
/ ~2 A5 W6 Z1 o4 Obuilt by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
+ U0 u6 A& @2 RTLS SNI support enabled
6 d5 z6 Z, F8 S9 I# I; M
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E
$ H4 }! @1 U+ V. A& F6 S

. q& R  W; Q, N3 a
, T" d, L4 a/ q( c% ]
啟動nginx       service nginx start   
( o/ S8 e/ |# ~$ M$ G- Verror :
4 A% t, w. x+ h" v1 Lnginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40- \* J" E+ W: y5 }9 ~
nginx: configuration file /etc/nginx/nginx.conf test failed' z9 ?6 H6 Y! X1 V# n
解決
將/etc/sysconfig/selinux 內的 enforced  設成 disabled    then   reboot    就可以了
6 Q4 E5 E3 i! |' j% J. N' a2 W  q" LSELINUX =  enforcing    改成   disabled 7 ^' Z4 e: D2 L- U
4 l+ f% q/ N* I9 G; K& O
* R# y# ?* y; u( z2 j

* t  O) Z9 `" L
6 E  s. p. K$ E




歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/) Powered by Discuz! X3.2