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;
}
}
|