Tuesday, December 23, 2014

kcyr7

Sunday, March 24, 2013

Nginx Load Balancing Basics

Nginx Load Balancing Basics: Nginx is a powerful high performance web server with a lot of features that can help high load projects to overcome their problems.

some nginx config file samples for balancing and failover



upstream myCloud{
  server 10.0.1.1;
  server 10.0.1.2;
  server 10.0.1.3;
}




upstream myCloud{
  server s1.domain.com;
  server 10.0.1.2;
  server unix:/tmp/backend;
  server 127.0.0.1:8080;
}




server {
  listen domain.com:80;
  access_log /var/log/nginx/proxy.log;
  
  location / {
    proxy_pass http://myCloud;
  }
}


upstream myCloud{
  ip_hash;
  server 10.0.1.1;
  server 10.0.1.2;
  server 10.0.1.3;



upstream myCloud{
  server 10.0.1.1;
  server 10.0.1.2 down;
  server 10.0.1.3;


upstream myCloud{
  server 10.0.1.1 weight=3;
  server 10.0.1.2;
  server 10.0.1.3 weight=2;

upstream myCloud{
  server 10.0.1.1 max_fails=3 fail_timeout=120;
  server 10.0.1.2;
  server 10.0.1.3;


upstream myCloud{
  server 10.0.1.1;
  server 10.0.1.2;
  server 10.0.1.3;
  server 10.0.1.8 backup;
  server 10.0.1.9 backup;