Apache 2.2.0 + mod_proxy_balancer
Apache 2.2.0 ãã¤ãã«ãªãªã¼ã¹ããã¾ãã¦ãããã¦ããæå¾ ããã¦ãã mod_proxy_balancer ãå®å®çã§ä½¿ããããã«ãªãã¾ãããmod_proxy_balancer ã¯ãã®åã®ã¨ãã Apache ã§ãã¼ããã©ã³ã¹ããããã® proxy ã¢ã¸ã¥ã¼ã«ã§ãã詳ãã解説㯠yappo ããããã¦ããã¦ãã®ã§ãã¡ããã
å®ã¯ mod_proxy_balancer 使ã£ã¦ã¿ããã¼ã¨æã£ã¦ Apache 2.2.0 ãã¤ã³ã¹ãã¼ã«ãããã¨ããããããªãèºãã¾ãããAPR 1.2.0 ãå ¥ã£ã¦ãªãããé§ç®ã ã! 㨠configure ã«å±ããã¾ãã¦ãã§ã APR 1.2.0 ã£ã¦ Apache 2.2.0 ã¤ã³ã¹ãã¼ã«ããªãã¨å ¥ããªãã? ã¿ãããªçç¾ãçºçãã¾ããããªã®ã§ãã¾ãæåã« srclib ã«ãã APR ãã³ã³ãã¤ã« & ã¤ã³ã¹ãã¼ã«ãã¦ããã®å¾ Apache2 ã®ã¤ã³ã¹ãã¼ã«ã¨ããé çªã§ãã£ã¦ãã¾ãããã¾ããã
$ cd httpd-2.2.0 $ cd srclib/apr $ ./configure $ make $ sudo make install $ cd .. $ cd apr-util $ ./configure --with-apr=/home/naoya/apr/bin/apr-1-config $ make $ sudo make install $ cd ../.. $ ./configure --prefix=/usr/local/httpd_proxy --enable-deflate \ --enable-rewrite \ --enable-proxy \ --enable-proxy-balancer \ --enable-ssl \ --with-mpm=prefork \ --with-apr=/usr/local/apr/bin/apr-1-config \ --with-apu=/usr/local/apr/bin/apu-1-config $ make $ sudo make install
ãããªæãã§ã
Proxy Balancer ã¯ãªããªã使ãæãããããç°¡åãªè¨å®ã§ããã«ä½¿ããã®ãããã§ãã管çç»é¢ãããã¼ãã®è¿½å åé¤ãã§ãããã¨ãã便å©ããã¨ãä½æ°ã« RewriteRule ã®ä¸ã§ balancer://foo ã使ããã®ãããã
<Proxy balancer://foo> BalancerMember http://192.168.0.1 loadfactor=10 BalancerMember http://192.168.0.2 loadfactor=10 BalancerMember http://192.168.0.3 loadfactor=10 </Proxy> RewriteEngine on RewriteRule ^/(.*)$ balancer://foo/$1 [P]
ãããªæãã§ãã¡ããã¨åãããªã®ã§ mod_rewrite ã§ããããè¤éãªãã¨ãããçµæã§ãã¡ãã㨠balancer ã«ä»»ãããã¨ãã§ãããã¹ãã©ã·ã¹ã