Skip to content

Instantly share code, notes, and snippets.

@qzaidi
Created March 11, 2012 01:35
Show Gist options
  • Save qzaidi/2014466 to your computer and use it in GitHub Desktop.
Save qzaidi/2014466 to your computer and use it in GitHub Desktop.
nginx a/b test config
upstream rrbackend {
server 127.0.0.1:8080 weight=3;
server 127.0.0.1:8888;
}
map $cookie_backend $backend {
default rrbackend;
experimental 127.0.0.1:8888;
}
map $cookie_backend $everything {
default 127.0.0.1:8080;
experimental 127.0.0.1:8888;
}
server {
root /var/www/foobar/;
index index.html;
server_name test.foobar.org;
access_log /var/log/nginx/foobar.access.log;
error_log /var/log/nginx/foobar.error.log;
location = / {
proxy_pass http://$backend;
}
location / {
proxy_pass http://$everything;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment