若魚 發表於 2013-9-9 21:32 - c! H) K9 ~- X! |- {
環境不一樣而已。。道理都一樣的。
7 j5 P/ _5 ^9 F: m) z你使用的環境,nginx配置是保存在/etc/nginx/下面的. N9 P: Y' \# ^0 [8 q3 E
虛擬主機配置則保 ...
- y+ k* P* _) v% Y8 x我把兩個文件都複製下:% w0 ?3 M# P8 p0 T4 }, _0 ]
0 s) z; j i# a9 S& ]
這個是虛擬主機下(/etc/nginx/sites-enabled/下面 ):" i2 |0 N5 s- T: W# P* o
server {* _2 z7 f- l* r, N" t. L
server_name www. XXX.com XXX.com;
F7 b X% N: I root /var/www/XXX.com;
/ s/ D- V& X( ^. e+ M* \3 ]) K5 [ include /etc/nginx/fastcgi_php;+ W6 w- \" ]. Y1 K
location / {
$ _5 ^, b( f/ S- y- R! h4 L index index.php;% ^: R4 {, I7 D' ?4 S5 g t; A
if (!-e $request_filename) {8 X, D4 Q8 v# ^" D
rewrite ^(.*)$ /index.php last;! {. z+ n5 O% O/ A( H y: p
}
5 D( ?6 R9 E& [" l, Z/ a* b }( F1 K% b; [3 v0 q
}
R/ U, Y! A0 a: l: M( @* W ?7 F/ X! {' h
這個是nginx配置(保存在/etc/nginx/下面的):+ t0 X" D6 F3 y
user www-data;6 C/ o a* a6 W
worker_processes 1;
1 d# k% p) W6 a; p8 k1 G( ^$ b7 U7 U+ S1 I4 o0 C/ K
error_log /var/log/nginx/error.log;
7 U$ G0 M# u# T! B" N, }9 Vpid /var/run/nginx.pid;
m- \$ c6 l4 A$ Q& {3 J2 e: ^% T" m. p8 i* z h
events {2 p8 c+ Z1 U; Q" H7 B; C Z. b
worker_connections 1024; y) L+ d0 _) K; s5 O& e4 |
# multi_accept on;% J8 L# j! W2 y. I
}
: S9 N$ D, E- Q {+ f
$ j1 [8 z4 d+ {# t$ i; hhttp {: H! @! [: q3 e% V7 j& \
include /etc/nginx/mime.types;4 I+ Z) \* H6 h3 d
, [+ }5 z4 \. k1 i, _* _6 m access_log /var/log/nginx/access.log;( \6 ^$ [$ k8 j( ?# h/ g9 ]2 k" B
- ]8 P/ W f( E0 z- Y sendfile on;
5 E; g4 m% B. `% Q6 |5 x #tcp_nopush on;
" V5 B; d* W+ I6 x# |! m1 T7 q8 d" a3 F$ ~
#keepalive_timeout 0;
/ d% s" _6 K/ b keepalive_timeout 65;
2 X8 s# p; z+ q5 U- E" O" o tcp_nodelay on;
7 @3 J0 y8 X, J1 P, B* V' Z% _+ t; e7 C* ]
gzip on;0 Z! d8 B( H z# D+ H
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
4 b" }7 m1 X) j1 r; m" S/ D! o1 s
' |9 r v. j I0 p" ^: @ include /etc/nginx/conf.d/*.conf;
( D; b* K- A# _ include /etc/nginx/sites-enabled/*;
+ t1 J/ g' \- c% ?/ ~! U# d}/ G" d- g8 }+ D4 C& ^
1 C1 E% O0 `: N: D w9 q8 w
# mail {2 Q( h* _! W( _: Y3 ^/ ~
# # See sample authentication script at:
. @/ V* G( E3 R8 E4 J ^# # http://wiki.nginx.org/NginxImapAuthenticateWithApachePhpScript1 M& t$ e& Z3 o7 O
# * U3 Z' J' B* h( v6 s2 x. S, J
# # auth_http localhost/auth.php;
8 i r. ~' F1 K" |4 L0 Q- U# # pop3_capabilities "TOP" "USER";
, C& G* b- q5 ` C7 m q# # imap_capabilities "IMAP4rev1" "UIDPLUS";
6 ^) O' M6 P$ z8 t+ B2 {1 J# 7 y5 |# J1 }, p0 j! C2 q
# server {) k2 m$ w" z1 j5 s% F3 x
# listen localhost:110;% U1 {$ o0 G# H( l
# protocol pop3;
% V4 |" k' ]2 g7 k. \/ m$ J1 A# X7 R8 k0 C# proxy on;
$ L7 B8 v/ l% U; r8 g: c6 I5 _# }
/ w2 s8 a& H. g" v c5 y8 x#
+ v, w6 w5 B5 S) t* z# server {
1 }1 l3 j i2 ~' M; Q* y# listen localhost:143;
8 u0 d9 q4 @- W# protocol imap;
2 y# t; [; e3 \4 s# proxy on;) ]. o v8 C3 V0 g1 B b7 g+ g
# }
: |6 ~7 ^5 {1 M, L# }
/ r) }: ]. t) e+ o' s F+ J& Q+ G6 s7 r% {( r
: x+ q; g2 i; F- m
7 a" G! G: e8 E1 H6 X; M" p" G
|