若魚 發表於 2013-9-9 21:32 
, r M, @+ I8 ^. | H8 U" V環境不一樣而已。。道理都一樣的。
( b/ p9 l k/ Y, o: f3 i" D n4 ^ h你使用的環境,nginx配置是保存在/etc/nginx/下面的 c( R( _+ V' ~' P) S5 `
虛擬主機配置則保 ...
( J* ~: u9 y9 W# C: ~我把兩個文件都複製下:+ K4 h8 b' n1 \
0 w5 K8 y0 c+ y3 Y6 t+ `
這個是虛擬主機下(/etc/nginx/sites-enabled/下面 ):
1 o5 M4 F2 j$ D1 Qserver {2 R% Y6 }7 F3 R, |% r+ B
server_name www. XXX.com XXX.com;
& Q7 A8 ^; _% T% [ root /var/www/XXX.com;
, f, J) ?# U. s3 W include /etc/nginx/fastcgi_php;! {5 G" L; q, K/ J: x7 r
location / {
4 t3 T- p# @% h9 ^ index index.php;
' s2 j( ?0 q+ {# a! Z+ Y% B if (!-e $request_filename) {
5 {! A) V$ x1 [) T: a4 B) Q" i! i: Q: W rewrite ^(.*)$ /index.php last;4 q( ?8 f: x) B2 R* Z* N* h2 `
}+ b- ?* J3 X0 ^
}% R: s h7 {1 q0 F- I* m% m4 P M
}
: {" A! W' d- i: L* k$ w
9 L! f+ [) {$ E2 k+ R8 t, A3 q7 ~這個是nginx配置(保存在/etc/nginx/下面的):, H2 F; `. F- y
user www-data;: ^5 W3 w0 K( b) Q0 D$ p& p3 P6 Z
worker_processes 1;
# @: g# X% A9 Q# o. `
( L' n7 R' ~; {$ z- herror_log /var/log/nginx/error.log;
) K' H9 a& d# a$ ^) Ipid /var/run/nginx.pid;
# ~- S% ?8 O2 S# T$ @) p
! V! S' L/ a9 Q$ r; [events {
; g/ j. J+ T7 r# Q% z) p worker_connections 1024;6 U: _( s3 L- r. U. l5 V( T9 i# K) K/ @
# multi_accept on;: ~8 r" R, [% D l9 x4 K/ K
}- ^! t- }- q- R8 f
8 j3 x' J4 I' Q* {" }; W) Ehttp {
- `$ Z: w/ K2 n8 m2 T! K include /etc/nginx/mime.types;% n4 {( C% n9 g$ O: O6 A) Z8 S
( H4 d( X0 s. r, K$ ~ access_log /var/log/nginx/access.log;* ?) J, A; f" {3 f* H' m9 B
- a. ~2 ]1 L' q- v/ g) l1 J2 f+ u sendfile on;
. G4 x1 A9 B. c; {$ \ k #tcp_nopush on; S6 j2 j2 B8 o) y% B8 h
6 [8 S* ?5 f3 f* @4 v #keepalive_timeout 0;
5 E, o* T. J/ P& T3 r2 J keepalive_timeout 65;, J( q2 R! V8 G. L) z# B
tcp_nodelay on;
# @( e" R3 V/ d, E: f7 g T d! n5 p2 S- U) H. B
gzip on;
$ T. l( b H) d+ {5 g; \5 t gzip_disable "MSIE [1-6]\.(?!.*SV1)";$ s; ^- E$ f0 C2 r( R
8 I+ ~1 n" o( c( D include /etc/nginx/conf.d/*.conf;
N7 ?. u# s$ Z8 v include /etc/nginx/sites-enabled/*;
4 {3 B; ~3 H( W) q4 |}# X9 t `% b: {6 _
* S2 j8 L2 M' T2 Y# mail {" k6 @1 p0 }: l0 I9 D- ]# S: X
# # See sample authentication script at:2 {. A2 P2 T s j# v
# # http://wiki.nginx.org/NginxImapAuthenticateWithApachePhpScript! x4 U1 s( j+ m( ]8 P( F% L! P4 b
# $ ?- ?" |! h! i
# # auth_http localhost/auth.php;
, g/ c& K( i: ~6 V- C/ F" G5 l3 B# # pop3_capabilities "TOP" "USER";
J" K5 W* a& o. h$ s9 C- E& K# # imap_capabilities "IMAP4rev1" "UIDPLUS";# @9 P! P& F% f! q! d d- L# K
#
1 {) R5 @1 B% Q" O6 c7 [$ ]# server {
& ^9 M4 t5 S3 Y G# F# listen localhost:110; ^& h6 l, ^8 h8 z
# protocol pop3;
9 @6 b5 a; d1 \/ w# proxy on;1 x7 l# ^! l$ R2 ?1 r& Y+ V% h
# }
0 v* Z, Q1 j/ Y) I, z& V5 X#
' w3 }$ ? Z( \( T) u# server {2 _7 T& r/ G- I3 s' I( [
# listen localhost:143;
3 {2 H$ Y, g0 E# protocol imap;. s0 W- |- `5 G$ S
# proxy on;6 A( l/ d7 m2 [# L/ k/ W# d7 x n
# }
2 `& S, Q( \9 Y& P# }$ Q% Y2 F6 N+ W. h1 _
; M- V" u. I' X& B# i- j1 C7 |3 S q% v1 B
$ D' P# u8 _9 d* c5 ~8 h. h6 k
" X1 \# v5 Z5 V y1 Y+ i
|