http://purplegrape.blog.51cto.com/1330104/1403123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
upstream prod {
server 192.168.1.10;
server 192.168.1.11;
}
upstream pre-prod {
server 192.168.1.100;
}
server {
listen 80;
access_log
/var/log/nginx/access
.log main;
set
$web_backend prod;
if
($remote_addr ~
"123.123.123.123"
) {
set
$web_backend pre-prod;
}
location / {
proxy_pass http:
//
$web_backend;
include proxy.conf;
}
}
|
1
2
3
4
5
6
7
8
9
10
11
|
server {
listen 80;
access_log
/var/log/nginx/access
.log main;
set
$rootdir
"/var/www/html"
;
if
($remote_addr ~
"123.123.123.123"
) {
set
$rootdir
"/var/www/test"
;
}
location / {
root $rootdir;
}
}
|
============http://kevinpeng.iteye.com/blog/1042430
http://blog.chinaunix.net/uid-531464-id-4140473.html