tid=211&《1》安裝nginx
7 j: {$ u$ {8 G% H9 q- ] yum install nginx+ Z1 X( `" M# j3 q7 A
.......... ~$ z1 I4 E6 E8 m
Running Transaction1 P) e6 ]# V' l J0 w: D* ?
Installing : GeoIP-1.5.1-5.el6.x86_64 1/3! Z& {! j/ {9 C3 s& B3 M, W
Installing : nginx-filesystem-1.0.15-11.el6.noarch 2/39 r' ?/ B' z$ f" V/ J( H
Installing : nginx-1.0.15-11.el6.x86_64 3/3
- O8 b# s; G9 \: N: Q: | Verifying : nginx-filesystem-1.0.15-11.el6.noarch 1/3
9 J" [2 g; h) n, U5 O. l5 M* E Verifying : nginx-1.0.15-11.el6.x86_64 2/3, ^8 T5 V6 {* l8 l/ I7 A5 J
Verifying : GeoIP-1.5.1-5.el6.x86_64 3/37 p! |' y. F6 ?: K4 Q% ~
6 \4 y# H' s7 M+ }2 RInstalled:; T) X3 _8 ^, {" W
nginx.x86_64 0:1.0.15-11.el6
. ?3 ]7 e; D8 E9 g8 V# i& IDependency Installed:
- K: a" i0 ~7 G( E GeoIP.x86_64 0:1.5.1-5.el6 nginx-filesystem.noarch 0:1.0.15-11.el6( B( Z) k( J( y( v% Y. n! X
Complete!
( E( \3 _. G- A
9 t+ N. [& N2 d9 C設定/etc/nginx/nginx.conf
6 F6 _6 e- |5 K! d T5 I7 M0 O! K; o6 Z( q7 u* S0 c
《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html" D ]; `7 _9 |. Z+ k3 V" l7 V. M
設定 /etc/php-fpm.d/www.conf user and group = nginx (default apache) ==> still error
& |4 F3 _- `! U0 ^" A7 B. \( ?
; O4 x; a; h! u0 E; ~9 q! \, q* |啟動php-fpm ⇨ service php-fpm start% @0 H/ |$ s8 j0 Z$ \
啟動nginx ⇨ service nginx start( c' L# S8 }9 b
〖結果〗:
! E1 q) [' H, d% |6 L+ n出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
9 Q( e% d+ d9 Q p$ x1 g〖解決〗:
) ^+ K9 I) q, V7 m4 U) m先找libgd.so.2 在何處(locate libgd.so.2*),結果在/usr/lib64/libgd.backup,所以cp /usr/lib64/libgd.backup/libgd.so.2* /usr/lib64
, c% d. f& S8 ]8 y2 {- Q% S& n再一次啟動nginx ⇨ service nginx start5 }" W2 |, ]8 E. C) T7 T
〖結果〗:nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:461 i9 Z6 Z) k/ |
先查看nginx 的configure ⇨ /usr/sbin/nginx -V' m5 l3 o$ b, W
nginx version: nginx/1.0.15' M, ?) t E" D( ]
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)+ C7 V+ d( B; F
TLS SNI support enabled
8 ?* X. k4 u5 x, bconfigure 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& J3 T; n7 W* q1 o( G
9 p5 J5 _2 g2 q; w% H4 g/ e6 U% G7 b' f
啟動nginx ⇨ service nginx start . A8 `3 s5 l& w, @& ~4 R
error : . ~- x. u% {0 e
nginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40
9 f9 I# v; @, a* ]# ^ rnginx: configuration file /etc/nginx/nginx.conf test failed
4 C5 J. ~; B' y5 R0 `: v# b〖解決〗:將/etc/sysconfig/selinux 內的 enforced 設成 disabled then reboot 就可以了
* H: B. a/ j" Y F pSELINUX = enforcing 改成 disabled
2 ?9 Z( `( G$ l; v. d: y$ i# g# p) M9 D6 n6 w9 m
2 s) S! [7 t# v! ~5 o5 U
3 n: E7 A* ~9 P$ J" _5 ]/ Q# f
9 k, ]8 r7 A# E |