Skip to content

Instantly share code, notes, and snippets.

@cardoni
Created February 2, 2015 19:09
Show Gist options
  • Save cardoni/88c64ab3bedde6d5bda4 to your computer and use it in GitHub Desktop.
Save cardoni/88c64ab3bedde6d5bda4 to your computer and use it in GitHub Desktop.
Nginx Config for A/B testing (50%/50%)
##
## Nginx Config for A/B testing (50%/50%)
##
split_clients "abtest${remote_addr}${http_user_agent}${date_gmt}" $variant {
50% "abtest.your_domain.com/a_test.html";
* "abtest.your_domain.com/b_test.html";
}
server {
listen 80;
server_name abtest.your_domain.com;
root /var/www/your_abtests_folder;
location / {
rewrite ^\/$ "${scheme}://${variant}" redirect;
}
# access_log off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment