Is this proxy setup realizable?
Igor Sysoev
is at rambler-co.ru
Wed Aug 20 08:25:08 MSD 2008
On Wed, Aug 20, 2008 at 01:18:05AM +0200, Samuel Vogel wrote:
> Igor Sysoev schrieb:
> >On Tue, Aug 19, 2008 at 01:05:33AM +0200, Samuel Vogel wrote:
> >
> >>I am planning on using nginx to be a reverse proxy infront of more than
> >>ten real servers, each containing 10 virtual machines. These virtual
> >>machines all contain the same setup lamp setup hosting about a 100
> >>users/domains each.
> >>This means as a total we have about 10.000 domains. As we provide low
> >>cost shared hosting on low cost servers, we can not switch the ip of a
> >>virtual machine between servers. So when we migrate a VM to a different
> >>physical server because of load reasons, it's IP changes as well.
> >>
> >>This is why we would like to use nginx infront as a reverse proxy. It
> >>would then always know the corresponding IP for a virtual machine and
> >>reroute the requests.
> >>
> >>With my current knowledge of nginx I would setup a virtual host for
> >>every VM we have and add all the domains it contains into the
> >>server_name variable. This would mean 100 virtual host with very long
> >>server_names, each containing 100 domains.
> >>
> >>Additionally I would like to use the reverse proxy setup to sanitize the
> >>requests, protect the VMs from dos attacks and if a VM goes down route
> >>all requests to this VM to a static file like "we'll be back soon".
> >>
> >>My question is, would this configuration be maintainable with nginx? Can
> >>it cope with long server_names and a rather strange setup like this? Or
> >>will it degrade my performance too much?
> >>
> >
> >nginx searchs server names via hash, so it will be quick opration.
> >nginx does primitive only sanitize.
> >As to "we'll be back soon", you need to use
> >
> > error_page 502 504 /back.html;
> >
>
> Great! So even more than 10.000 domains would not matter and there is no
> size limit to server_name?
No limit, however, you should increase server_names_hash_max_size
and, probably, server_names_hash_bucket_size. nginx will say by itself.
First you should increase server_names_hash_max_sizeand only.
A large number of server_name may cause reconfiguraiton delay as nginx
finds the best hash size, but in run-time the will no delay.
> As for the "we'll be back soon" page, I thought I'd put the real server
> (VM) and a server only containing this error page into an upstream
> section and mark the error page server as backup.
> But if the 502 and 504 errors achieve the same effect, this makes things
> easier!
However, you still need to add
location = /we_ll_be_back_soon.html {
root /path/to/thepage;
}
in every server. The
error_page 502 504 /we_ll_be_back_soon.html;
can be set on http level.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list