由于从未实践,仅作记录:
三台机器 前端机:160 ,后端机:161(虚拟ip162)163(虚拟ip164)
160配置:
#http中 upstream www.mlonz.com { server 192.168.1.164:80; server 192.168.1.162:80; } server { listen 80; server_name www.mlonz.com; location / { proxy_pass http://www.mlonz.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
161和163配置:
server { listen 80; server_name www.mlonz.com; index index.php; root /data0/htdocs/youyoule/; rewrite ^/(.*)$ /index.php?/$1; location ~ ^(.*)\/\.svn\/{ deny all; } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } access_log /data1/logs/mlonz112.log; }