《1》安裝nginx0 B/ j4 d- U4 C1 A Q6 P4 d. U# ~+ b
yum install nginx
8 X5 B" u9 y1 q, L..........! j, ?) X1 |/ Q' D4 l
Running Transaction
1 j; w4 D! j: _5 T; t0 B! Z( R9 z Installing : GeoIP-1.5.1-5.el6.x86_64 1/3) `; B( a0 I: t* g! c
Installing : nginx-filesystem-1.0.15-11.el6.noarch 2/3. a. c4 f5 D- N9 H' @) C0 S
Installing : nginx-1.0.15-11.el6.x86_64 3/3" v6 x3 A, v6 ]/ t
Verifying : nginx-filesystem-1.0.15-11.el6.noarch 1/3
& k$ k6 @: N% n/ _$ t/ z Verifying : nginx-1.0.15-11.el6.x86_64 2/3
7 y5 }; N. y3 i4 y8 N8 B Verifying : GeoIP-1.5.1-5.el6.x86_64 3/3
4 }. o+ T: K9 G1 V+ q- y; x( `# M& h
Installed:% M$ J6 s. j! Z% J, g$ X' C# j
nginx.x86_64 0:1.0.15-11.el62 [- d5 @6 ?+ E( W! c0 T$ g
Dependency Installed:
/ r- ]7 Z- j, x, I. \ GeoIP.x86_64 0:1.5.1-5.el6 nginx-filesystem.noarch 0:1.0.15-11.el6/ V3 O/ y& E1 Z$ N+ g: l
Complete!+ r+ }3 P" Q- I$ Z) l
8 x6 [8 Z: Y) J9 `設定/etc/nginx/nginx.conf- T2 L: x; ~8 W5 c7 u
/ d& y+ Q4 \& }2 x4 X2 U1 G《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html! }% J2 c, p7 H N% M/ I
設定 /etc/php-fpm.d/www.conf user and group = nginx (default apache) ==> still error' K# o, ]+ y& u8 H: R! B# v4 X) V
L/ A& ]( F7 [; y
啟動php-fpm ⇨ service php-fpm start0 R& P6 r. J7 n& l3 D) N" ^; V- M
啟動nginx ⇨ service nginx start
2 ]1 p/ W* G+ p! v- a〖結果〗:6 q9 Z5 M' {9 I( Y; r* M) T' e1 e
出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
) f7 }" P8 }: K〖解決〗:. H. O' h, U: \% A2 G+ s
先找libgd.so.2 在何處(locate libgd.so.2*),結果在/usr/lib64/libgd.backup,所以cp /usr/lib64/libgd.backup/libgd.so.2* /usr/lib644 k" X% l& D0 X5 `5 W
再一次啟動nginx ⇨ service nginx start5 z6 G# |' g- y7 U* t: C
〖結果〗:nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:46* j- v$ R" J% Y7 ^
先查看nginx 的configure ⇨ /usr/sbin/nginx -V
+ O) s( G. Y( G' e, e4 g9 Wnginx version: nginx/1.0.153 G. \6 q6 F0 z0 l* o& e7 n
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)' s' i: n, @5 A% O
TLS SNI support enabled
$ u9 ]+ y3 C+ g5 W( O# qconfigure 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) j: @( ~# S! h4 C7 Z2 b" y8 H+ Z: @
" R" R2 U6 w. a4 k1 `" B. d1 Q8 m& k9 _" q4 @
啟動nginx ⇨ service nginx start
0 Z8 u+ j4 J' [ C6 I: ferror : 5 C6 T) m7 `3 A
nginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40
( m5 G2 D9 \+ R0 O& d# c5 Fnginx: configuration file /etc/nginx/nginx.conf test failed
( W, x% I. K; O% @1 u$ c〖解決〗:將/etc/sysconfig/selinux 內的 enforced 設成 disabled then reboot 就可以了
5 a" [8 j& ]; q/ Z8 USELINUX = enforcing 改成 disabled 2 Q: ~& g4 p6 K% D
1 X' X( r# M2 z0 M P# L X) |6 C4 H1 P7 J& E1 O6 A
. D5 Z0 @0 H- k; v
4 t/ U) |* U1 A- C3 C |
|