Nginx A/B 测试
我正在尝试进行 A/B 测试,并且为此目的使用 Nginx。我的 Nginx 配置文件如下所示:
events {
worker_connections 1024;
}
error_log /usr/local/experiments/apps/reddit_test/error.log notice;
http {
rewrite_log on;
server {
listen 8081;
access_log /usr/local/experiments/apps/reddit_test/access.log combined;
location / {
if ($remote_addr ~ "[02468]$") {
rewrite ^(.+)$ /experiment$1 last;
}
rewrite ^(.+)$ /main$1 last;
}
location /main {
internal;
proxy_pass http://www.reddit.com/r/lisp;
}
location /experiment {
internal;
proxy_pass http://www.reddit.com/r/haskell;
}
}
}
这是可行的,但 css 和 js 文件无法加载。 谁能告诉我这个配置文件有什么问题或者正确的方法是什么?
谢谢,
亚历克斯
I'm trying to do A/B testing and I'm using Nginx fo this purpose. My Nginx config file looks like this:
events {
worker_connections 1024;
}
error_log /usr/local/experiments/apps/reddit_test/error.log notice;
http {
rewrite_log on;
server {
listen 8081;
access_log /usr/local/experiments/apps/reddit_test/access.log combined;
location / {
if ($remote_addr ~ "[02468]$") {
rewrite ^(.+)$ /experiment$1 last;
}
rewrite ^(.+)$ /main$1 last;
}
location /main {
internal;
proxy_pass http://www.reddit.com/r/lisp;
}
location /experiment {
internal;
proxy_pass http://www.reddit.com/r/haskell;
}
}
}
This is kind of working, but css and js files woon't load.
Can anyone tell me what's wrong with this config file or what would be the right way to do it?
Thanks,
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论