# Nginx to load balance application servers

**URL:** <https://www.ruby-forum.com/t/nginx-to-load-balance-application-servers/159321>\
**Category:** NGINX\
**Created:** [February 3, 2009, 1:17pm UTC](https://www.ruby-forum.com/t/nginx-to-load-balance-application-servers/159321 "2009-02-03T13:17:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zimbirti\_zimbirti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c68b51/32.png) [@zimbirti\_zimbirti](https://www.ruby-forum.com/u/zimbirti_zimbirti)\
**Post date:** [February 3, 2009, 1:17pm UTC](https://www.ruby-forum.com/t/nginx-to-load-balance-application-servers/159321/1 "2009-02-03T13:17:28Z")

</div>

I have a blog system with seperate subdomain and domains and want to use  
nginx to load balance application servers.

I want to give total number of servers available for example 5 and want  
to  
redirect all requests to the same server everytime.

For example

[a.blog.com](http://a.blog.com) will go to server 1  
[b.bllog.com](http://b.bllog.com) =\> server 2  
[b.bllog.com/x.html](http://b.bllog.com/x.html) =\> server 2  
[xx.com](http://xx.com) =\> server 1

and so on.

I am thinking doing this by converting domain name “[a.blog.com](http://a.blog.com)” to  
number  
with crc32 and modulo that number to number of servers (5) and  
remaining  
number wiill deceide which server to send this requests.

I wander how to do this. is it through perl or can it be done with  
config  
file alone. and how to to it in any way?

---

<div class="post-metadata">

**Author:** ![zimbirti\_zimbirti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c68b51/32.png) [@zimbirti\_zimbirti](https://www.ruby-forum.com/u/zimbirti_zimbirti)\
**Post date:** [February 4, 2009, 4:59am UTC](https://www.ruby-forum.com/t/nginx-to-load-balance-application-servers/159321/2 "2009-02-04T04:59:37Z")

</div>

i think it may use the url\_hash  
it is not bnuilt-in  
you can down the patch from the nginx’s website

Date: Tue, 3 Feb 2009 12:04:00 +0000Subject: nginx to load balance  
application serversFrom: removed\_email\_address@domain.invalid: removed\_email\_address@domain.invalid  
have a blog system with seperate subdomain and domains and want to use  
nginx to load balance application servers. I want to give total number  
of servers available for example 5 and want to redirect all requests to  
the same server everytime. For example [a.blog.com](http://a.blog.com) will go to server  
[1b.bllog.com](http://1b.bllog.com) =\> server [2b.bllog.com/x.html](http://2b.bllog.com/x.html) =\> server [2xx.com](http://2xx.com) =\> server  
1and so on. I am thinking doing this by converting domain name  
“[a.blog.com](http://a.blog.com)” to number with crc32 and modulo that number to number of  
servers (5) and remaining number wiill deceide which server to send  
this requests. I wander how to do this. is it through perl or can it be  
done with config file alone. and how to to it in any way?
