<a42b2c16fb320a285d06245963adb12e@ruby-forum.com>
Daniele :) wrote:
> Hi,
> I'm testing a Rails app that serves multiple different sites with a
> virtual hosts configuration under nginx. I need to set a limit
> per host basis so a single site will be unable to eat all the bandwidth
> and
> server resources. Nginx can limit per ip but not per vhost, right?
>
> Any solution?
> Thank you in advance :)
nginx currently can limit bandwidth only on per-connection basis.
But we can limit rate for each connection, and than limit maximum number of connection to each
virtual host.
Somethings like:
http {
limit_rate 250000;
limit_zone conn_to_server $server_name 10m;
limit_conn conn_to_server 100;
server { ... }
server { ... }
server { ... }
}
With this settings each virtualhost can't use more than 250000*100 = 25 Mbit of bandwidth.
--
Anton Yuzhaninov