《1》安裝nginx
$ i" }" i) r. q5 w2 ^. Z yum install nginx
5 B( [! i2 V5 D" Q; y1 B..........
6 k# F& j) ~5 ]" v, ?8 qRunning Transaction
# z4 G* d# o6 U Installing : GeoIP-1.5.1-5.el6.x86_64 1/36 y3 A4 e4 P, ], K7 x& v
Installing : nginx-filesystem-1.0.15-11.el6.noarch 2/3+ M/ R+ B! d: c2 y3 q ~7 u: Q0 }
Installing : nginx-1.0.15-11.el6.x86_64 3/3# ?. `1 Z8 } q6 P( M3 t( P ^
Verifying : nginx-filesystem-1.0.15-11.el6.noarch 1/3, j! ^& C0 ^/ h- W" w( I
Verifying : nginx-1.0.15-11.el6.x86_64 2/3
4 h0 [9 H! p9 O; l/ M Verifying : GeoIP-1.5.1-5.el6.x86_64 3/36 E! f6 W7 ]% l' V% W) Z
d! j+ ?, v- A0 g8 E
Installed:. x( e: N! [- P' }2 Z3 W, L1 y
nginx.x86_64 0:1.0.15-11.el6
0 P& \ R. h& d- b9 d+ DDependency Installed:
/ @3 ]2 Z8 D" i& n* j GeoIP.x86_64 0:1.5.1-5.el6 nginx-filesystem.noarch 0:1.0.15-11.el62 q# g, P+ x4 z9 I1 @1 X5 |
Complete!$ z6 C) z& ?) n- b, U
2 z7 S5 O, g) }/ |& {, [) h# ~0 e設定/etc/nginx/nginx.conf) x6 |3 y( ?# k5 e& u2 ^
# D& N9 B7 d! a( F. \. H' J《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html/ N- \8 v. T7 V' h0 Y* r
設定 /etc/php-fpm.d/www.conf user and group = nginx (default apache) ==> still error
3 }% @' v+ a) ^8 L' d4 g: C Z) S% o" h. X/ e" I- d
啟動php-fpm ⇨ service php-fpm start
) P2 ~# m- l+ ~! k" t啟動nginx ⇨ service nginx start
8 @5 R8 L6 i! V) T〖結果〗:
( I/ Y4 p/ }+ w出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
3 ]" ]. M4 Y) C' L! r$ p' y# R〖解決〗:- \3 l0 E, e4 q8 Y4 t2 h& ^# z. _4 a
先找libgd.so.2 在何處(locate libgd.so.2*),結果在/usr/lib64/libgd.backup,所以cp /usr/lib64/libgd.backup/libgd.so.2* /usr/lib64, P' s2 \7 D) a" b9 }) o
再一次啟動nginx ⇨ service nginx start" C) U" q R) i2 V% `4 E$ ]
〖結果〗:nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:46
% Z3 I" H. d; S% g& `* _# w, W先查看nginx 的configure ⇨ /usr/sbin/nginx -V
3 }& V' A9 q+ z9 rnginx version: nginx/1.0.15
% U3 }% d n) `5 s! ^5 J8 tbuilt by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC). X) t9 W/ k9 M7 Q) Q
TLS SNI support enabled
. B9 V0 g( i% r; b3 Z: T4 |5 Z+ pconfigure 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" o. ^8 d% i" K/ g$ }
5 c, L5 c' _2 j7 Z# w$ n* w
+ L( j# U4 f9 Y啟動nginx ⇨ service nginx start
& u4 U/ m& [& g6 b0 L% o, _ nerror :
' |' _5 l$ Q" j8 V0 U9 l6 G8 cnginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40* Q, T$ b- C$ C
nginx: configuration file /etc/nginx/nginx.conf test failed
6 z, E4 P+ e9 \, v3 U7 b0 I〖解決〗:將/etc/sysconfig/selinux 內的 enforced 設成 disabled then reboot 就可以了
5 I: [6 }/ n0 P# a: ?% f: ySELINUX = enforcing 改成 disabled ( s1 Z% f: \" d, K
* a0 I \. p" I6 W# j
) W9 O# R$ @! S3 s4 b6 M/ M+ w$ {5 F0 W2 ?) Z, |3 |' G
- A* i4 K2 \$ o6 y# ~. G |
|