Nginx Load Balancing
image, load-balancing, nginx, proxy, redirect
Solution
http {
split_clients "${remote_addr}" $server_id {
33.3% 1;
33.3% 2;
33.4% 3;
}
server {
location ~* \.(gif|jpg|jpeg)$ {
return 301 "${scheme}://s${server_id}.site.com${request_uri}";
}
}
Problem
I want to load balance my website with nginx. The load balancing in nginx wiki is proxy, so the actual file being downloaded from the frontend server. (http://wiki.nginx.org/LoadBalanceExample) This is how I need the balancing: user request file: - http:// site.com/image1.jpg nginx redirect user to one of the servers (with Location header): - http:// s1.site.com/image1.jpg - http:// s1.site.com/image1.jpg - http:// s3.site.com/image1.jpg Is this possible with nginx?