ぶろぐ

日記です

nginxでap鯖振り分け


さくっと建てたい時がきっとあるのでメモ

worker_processes  1;
events {
  worker_connections  1024;
}

http {
  upstream web {
    server localhost:9000 weight=5 max_fails=50 fail_timeout=100m;
    server localhost:9001 weight=5 max_fails=50 fail_timeout=100m;
  }
	server {
    listen       80;
    server_name  localhost;
    charset      utf-8;
    location / {
      proxy_pass http://web;
      proxy_pass_header Set-Cookie;
      index index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   html;
    }
  }
}

起動方法

nginx -c ~/nginx.conf