tid=211&《1》安裝nginx
# H2 c, t5 I. E! ^ yum install nginx
! ^; N; D' N3 T! I..........+ [+ K! M& z8 F1 t9 T3 v
Running Transaction
7 F* e- Z: ^7 i Installing : GeoIP-1.5.1-5.el6.x86_64 1/3: A0 K$ h: e9 n$ x7 N
Installing : nginx-filesystem-1.0.15-11.el6.noarch 2/3
6 f8 M5 G- A0 P2 U' U I1 @" q Installing : nginx-1.0.15-11.el6.x86_64 3/3
/ ?2 E1 H7 @ y& P4 G5 r Verifying : nginx-filesystem-1.0.15-11.el6.noarch 1/3
& \3 I8 r" ^& O& C Verifying : nginx-1.0.15-11.el6.x86_64 2/3
8 `. E! J6 L T+ }% C, n Verifying : GeoIP-1.5.1-5.el6.x86_64 3/3
( ~: v: z B1 }
& ] }; B! k q: H- MInstalled:2 L' |: z: r$ H9 L4 @
nginx.x86_64 0:1.0.15-11.el6) B9 a, e5 X/ g$ B6 x5 a6 g: S; x
Dependency Installed:! S; n$ | E ^$ D- X
GeoIP.x86_64 0:1.5.1-5.el6 nginx-filesystem.noarch 0:1.0.15-11.el6/ p. z8 D' a+ G3 B$ ~
Complete!
2 o! l4 ~: S3 Z5 B% Q0 V! H: E& }5 A! l
設定/etc/nginx/nginx.conf- P9 m& c6 @! c$ v5 |6 a
/ t; `3 ]9 N. C. k2 @* ~( y
《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html
# e" j, p5 X/ D+ _. [8 ^/ a設定 /etc/php-fpm.d/www.conf user and group = nginx (default apache) ==> still error
- Z& I! _: V$ ]5 a! |+ [( I6 ^6 N$ P( m9 C1 q
啟動php-fpm ⇨ service php-fpm start
! v) a. d' ^( D9 ]啟動nginx ⇨ service nginx start: f. f! T$ L9 H1 e
〖結果〗:
9 A/ n; z T+ s出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
8 s3 s3 ^0 c" ]/ X〖解決〗:: w* w' ~* t2 @3 f
先找libgd.so.2 在何處(locate libgd.so.2*),結果在/usr/lib64/libgd.backup,所以cp /usr/lib64/libgd.backup/libgd.so.2* /usr/lib64
* |1 A# x- y2 R; B再一次啟動nginx ⇨ service nginx start: ?: x) z: a6 N7 J
〖結果〗:nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:46
7 n' i( Z) I q [7 s1 I' ^! i先查看nginx 的configure ⇨ /usr/sbin/nginx -V; I- y( {2 P8 y, n" f: p
nginx version: nginx/1.0.15
7 D5 X+ D0 _4 N$ j# x8 U* Z: @5 S9 [$ o4 Kbuilt by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
& t1 v4 y% a+ ]0 }4 g. Q0 `TLS SNI support enabled' K% w2 l" k8 `- c' 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+ b+ H ~% V# p3 M4 R. R2 J" [
. \7 B U- h* H% K: [0 m$ I* K
( [1 L3 r: i x$ J! h
啟動nginx ⇨ service nginx start
4 \/ \) x! i6 A( R/ B7 [6 Ferror :
" y% n6 L3 {# y* U8 a5 R9 tnginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40
5 |4 p# F) s2 n1 u/ i2 T. t3 wnginx: configuration file /etc/nginx/nginx.conf test failed( P3 \/ P# y: }) e; N) q
〖解決〗:將/etc/sysconfig/selinux 內的 enforced 設成 disabled then reboot 就可以了' m+ r$ G: M% h* I3 @9 Q
SELINUX = enforcing 改成 disabled
. O3 S+ D6 G+ r: t" E( A' }8 [' T2 p. `3 E3 l8 e
6 m7 Y7 p+ p' M/ L3 d; h$ [$ Z! v/ n5 Y0 l
5 a6 n" ~5 \/ i! t |