Welcome! Log In Create A New Profile

Advanced

Load Balance Two Sockets with Different Roots

Posted by np7776 
Load Balance Two Sockets with Different Roots
March 08, 2016 07:38PM
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;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 89
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready