Can I serve a different document root on nginx based on client ips? Basically I would like the same url to serve a different branch of my code for my client ip.
For example, this is what I would expect the config to be:
server {
listen 80;
server_name some.server.name;
client_max_body_size 10M;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
root {{ deploy_directory }};
location /robots.txt {}
if ($remote_addr ~ "^(<ip>|<ip>|<ip>)$") {
root <some other root>
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
log_not_found off;
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
}
But that doesnt load