I am using Unicorn as the application server in front of my web application. I want to essentially do blue/green testing by having two versions of the site running at the same time. The problem is that the root path is different from one version of the site to the other. Is there a way to do this?
This is my config. Right now it doesn't work because when the second server comes up in round robin the files are broken because they aren't at the root path.
upstream unicorn {
server unix:/tmp/unicorn.main.sock fail_timeout=0;
server unix:/tmp/unicorn.main_staging.sock fail_timeout=0;
}
server {
listen 80;
server_name mysite.com;
root /var/www/sites/main/current/public;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
error_page 500 502 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
This is my config. Right now it doesn't work because when the second server comes up in round robin the files are broken because they aren't at the root path.
upstream unicorn {
server unix:/tmp/unicorn.main.sock fail_timeout=0;
server unix:/tmp/unicorn.main_staging.sock fail_timeout=0;
}
server {
listen 80;
server_name mysite.com;
root /var/www/sites/main/current/public;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
error_page 500 502 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}