tid=211&《1》安裝nginx8 N& O5 U! I' J* F3 Y4 u. [
yum install nginx
5 p/ j- ]" L+ [* F! x0 C..........
* v2 Z j7 j/ \/ mRunning Transaction
) K) j) v( @8 S! ? } Installing : GeoIP-1.5.1-5.el6.x86_64 1/38 @& ?$ V# ^' l9 ]0 F5 R
Installing : nginx-filesystem-1.0.15-11.el6.noarch 2/3- p/ _) W2 ~' k# ^: \5 ]5 r
Installing : nginx-1.0.15-11.el6.x86_64 3/3( D, g4 ^$ U$ u6 y0 C# k
Verifying : nginx-filesystem-1.0.15-11.el6.noarch 1/3
( \) Z% w9 S# v S( W Verifying : nginx-1.0.15-11.el6.x86_64 2/38 v, g$ e' ~9 o, z/ `7 C' \
Verifying : GeoIP-1.5.1-5.el6.x86_64 3/3
! f4 j2 { f' b: k4 q
: j& E( _+ \ I1 j/ H" m3 TInstalled:
: K$ @! r/ o( z* V/ o7 |# I4 j nginx.x86_64 0:1.0.15-11.el6
3 e \; b2 ?' UDependency Installed:
! Q# Y( i, S5 v6 { GeoIP.x86_64 0:1.5.1-5.el6 nginx-filesystem.noarch 0:1.0.15-11.el6( r. H" {! T. `. X" b
Complete!
0 @8 l2 e) C6 ~' x% O) u' B; r/ _3 W
/ e! _ s" V) u) b/ N7 C設定/etc/nginx/nginx.conf
' Z2 n5 L! H3 ?7 S" y8 {5 Y) o6 o) L. k' I" f
《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html
) }+ j% {! R8 v% B2 N- Q設定 /etc/php-fpm.d/www.conf user and group = nginx (default apache) ==> still error
* } O+ v- f8 P1 l% b- N
. G. p; S- u' E+ I7 t啟動php-fpm ⇨ service php-fpm start
/ u' o m: t7 I d S* R# h啟動nginx ⇨ service nginx start, ^# }( W; t7 v, L& E# ?! C$ ]
〖結果〗:
' `# e, r, m: j7 Q/ T- z出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory' R9 r2 f+ l# S2 V6 ^) O7 j
〖解決〗:
" c: z2 [- |& ?( I! G1 u先找libgd.so.2 在何處(locate libgd.so.2*),結果在/usr/lib64/libgd.backup,所以cp /usr/lib64/libgd.backup/libgd.so.2* /usr/lib64
2 c* n/ s) ~$ E' [ Q$ ]* Z再一次啟動nginx ⇨ service nginx start
9 X$ r7 }5 v# _. Y〖結果〗:nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:46* q3 U0 \ E5 \% x0 a$ P
先查看nginx 的configure ⇨ /usr/sbin/nginx -V
8 {4 ?- U9 S* H; p z2 \% \nginx version: nginx/1.0.15! x) W& A: D( A$ L: b
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
6 q3 n; p1 S+ Z* @TLS SNI support enabled q, S3 _4 E! h5 r1 k, ~- o) O
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& v+ B6 W0 M& q
, s) b# j6 ?! B1 @6 F. d$ x- U/ P( [2 G# v9 b; s% e
啟動nginx ⇨ service nginx start
' H: B( |: W9 D$ g( jerror : * u% |( ^6 C' [7 w d3 @$ s
nginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40
+ t# }- c' _# |( h8 Jnginx: configuration file /etc/nginx/nginx.conf test failed) ^! W, z5 R+ C9 ?( |
〖解決〗:將/etc/sysconfig/selinux 內的 enforced 設成 disabled then reboot 就可以了
% u5 _4 A' @3 j- n- t2 m) aSELINUX = enforcing 改成 disabled
& N7 L* ~: P: f" O4 E& ~: K# R
. y6 r0 q, N/ h* X( L7 F/ X& t; H4 | X4 Y- Q
7 R' Q5 }, C9 ^- f
/ g4 ^6 L2 L) J& R- } |