《1》安裝nginx) [5 e% ]" A" _. K. Y
yum install nginx
5 w/ X8 u+ y/ M y7 x) }..........) \1 Q7 L' J# }0 S, m& w! N/ d/ g" d
Running Transaction( `0 G/ g; _& |$ N# G$ J
Installing : GeoIP-1.5.1-5.el6.x86_64 1/3
6 g+ ^- r5 T, x% Q3 w, J/ _ Installing : nginx-filesystem-1.0.15-11.el6.noarch 2/3
+ Q* x2 y0 j: Y* Y/ y) z+ ~ Installing : nginx-1.0.15-11.el6.x86_64 3/3
, \( ?3 W" x- Q) }# g5 G9 X' e/ @! o Verifying : nginx-filesystem-1.0.15-11.el6.noarch 1/3
; }- r' f" ]) v5 Q Verifying : nginx-1.0.15-11.el6.x86_64 2/3
& _; H2 `7 p8 ^' k8 n Verifying : GeoIP-1.5.1-5.el6.x86_64 3/3
; f5 i; M5 D3 ~" k/ U
' G0 x- t# C& C' oInstalled:
2 [- ~% ~; g! a- D5 u* n nginx.x86_64 0:1.0.15-11.el65 t& r+ i; S+ s! K1 c
Dependency Installed:, C9 N L( Q) m$ E
GeoIP.x86_64 0:1.5.1-5.el6 nginx-filesystem.noarch 0:1.0.15-11.el6
6 I& W; w# Z9 z2 J' dComplete! j) {* d7 Y! U2 r, ?; m( y" s
# C: F0 M x( p8 n設定/etc/nginx/nginx.conf
- i! S7 f* a+ Q4 x1 [+ g. V" j& g; q6 j3 c; m' W) U& _! v3 W
《2》安裝php-fpm: 參考http://www.av4u.info/thread-201-1-1.html
O, x: V# L' O" c7 H5 L設定 /etc/php-fpm.d/www.conf user and group = nginx (default apache) ==> still error6 H1 F8 ?8 W$ t$ z8 O: V. _7 P. j
a2 x8 J, P+ o$ ?啟動php-fpm ⇨ service php-fpm start( ], z( w0 r( Q8 u& n! f* U, R7 F% |
啟動nginx ⇨ service nginx start
) S/ u7 m0 P1 L2 o5 R5 t/ G% s〖結果〗:4 ^& I) c+ V9 W6 F4 l% L
出現error :nginx:/usr/sbin/nginx: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
1 N9 w( e3 U3 n! ~& X〖解決〗:
" ]$ M( Q2 t8 y; j) q: o先找libgd.so.2 在何處(locate libgd.so.2*),結果在/usr/lib64/libgd.backup,所以cp /usr/lib64/libgd.backup/libgd.so.2* /usr/lib64* v! f9 \: t+ H
再一次啟動nginx ⇨ service nginx start
! ]2 u7 C$ n- s/ k2 d, m Y+ ~. `〖結果〗:nginx: [emerg] unknown directive "upload_progress" in /etc/nginx/nginx.conf:468 @1 w, V; H, V4 C2 U: }5 ^
先查看nginx 的configure ⇨ /usr/sbin/nginx -V2 v- k% A5 t, \& i& F6 J$ ]+ M1 ]9 V
nginx version: nginx/1.0.15
/ b. F; e( V Y! t0 Ibuilt by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
8 M; m+ l) T' v4 ?, R8 _TLS SNI support enabled
4 v/ T% I( n& wconfigure 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$ C5 U! V: |* G) M# g
+ g! {7 F3 p( I7 R. _" H- K% G% E4 Y- ]% c. k! }
啟動nginx ⇨ service nginx start 1 m0 b9 B5 O3 T" [* D$ v7 R9 S4 C' G
error :
6 K+ _% u& _+ ]8 T' k- e5 cnginx: [emerg] open() "/etc/nginx/conf.d/db52av.52av.tv.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:40
& E/ I2 R2 q# _& K0 Xnginx: configuration file /etc/nginx/nginx.conf test failed' \% d& K- U9 ~: P) @
〖解決〗:將/etc/sysconfig/selinux 內的 enforced 設成 disabled then reboot 就可以了1 j1 G# }2 I( C4 Z! Q l3 j |
SELINUX = enforcing 改成 disabled # ^1 t T# k2 S7 m5 i
; r- {5 _$ _6 {3 i2 w- O
4 V4 {6 I5 c4 s3 s
( [: |) G- H7 p* v& i/ h3 s! n5 Z6 X, b( W3 S3 L2 P, ~: k
|
|