餱ȥƥȤͫݵ

⤷ƤȤɽεϿøȽ񤯡

httpd

[ɽ]Apache⥸塼 ץߥ󥰥5

Apache⥸塼 ץߥ󥰥 (Advanced Serverside programming꡼)Apache⥸塼 ץߥ󥰥 (Advanced Serverside programming꡼)
ԡ Ƿ
丵ɾ
ȯ2003-08-01
١5.0
ߤ򸫤

Apache⥸塼ΤȤդApache httpd߷׻ۤ䥢ƥΤͭѤƤ

оݤȤƤhttpdΥС1.3ȸŤΤΡ2.0ȤκʬϿˤޤȤޤäƤʤɡڤʹ

⥸塼Ԥ̵Ƥ⡢ꥯȽ롼פιͤʤɤϡhttpd.confν򿼤뤳Ȥϴְ㤤ʤApache httpdεư䡢¾Υ⥸塼Υɤ꤬ˤʤ

ߤϼŤ餤褦ǿǤ˹碌ƤǤβԤ

mod_proxy_balancerstickysessionʸʸ̤

ʤä褦˵Ƴ

ǡäȤȡapache httpd-2.2.4źդmod_proxy_balancerεư

mod_proxy_balancerˤĤƤפmod_proxyϤγƼ⥸塼proxyХ󥷥󥰤Ǥ櫓Ǥʡmod_proxy_balancerΤϤʤΤ⥸塼ʤɡ󺤤äӤmod_proxy_ajpȤȤ߹碌Ĥޤmod_jk(2)ѤȤƻȤäȤΤȡ

Ȥwebؤapache(+mod_ajp +mod_proxy_balancer)1桢apؤtomcat2湽ˤȤstateful˿ʬ򤹤ɬפäơtomcatǥåץꥱ󤬻ȤʤstickysessionεǽȤ

httpd.confǤϤʤ󤸡

 ProxyPass /webapp/ balancer://testcluster/webapp/ stickysession=ss
 <Proxy balancer://testcluster>
        # r0
        BalancerMember ajp://192.168.100.10:8009 loadfactor=1 route=r0
        # r1
        BalancerMember ajp://192.168.100.11:8009 loadfactor=1 route=r1
 </Proxy>

ssȤѿr0Ȥʸ󤬴ޤޤ줿(ss=hogehhuga.r0 Τ褦˥ԥꥪ+ʸǽä)ˤajp://192.168.100.10:8009ˡajp://192.168.100.11:8009r1Ȥʸ󤬴ޤޤ줿ˤajp://192.168.100.11:8009proxyȤΡѿȤ϶ŪˤCookieCGIĶѿurlѤǤ륹Τ

tomcatղäƤjsessionidjvmRouteȤ߹碌stickysession¸Ǥ褦ˤʤ롣2tomcatjvmRouteˤ줾r0, r1ꤹȡUACookieȤˤʤäƤCookieJSESSIONID=hanamogerahogehoge.r0CookieȤʤUAˤURLѥ᡼Ȥ;jsessionid=gegehogegehoge.r0ȤäͤղäƤ롣httpd.confǰʲΤ褦ꤷƤСJSESSIONIDr0äƤtomcat(r0)ˡr1äƤtomcat(r1)ajp³Ƥ롣ĤsessionƱƥʤ³롢ȤȤߡ

 ProxyPass /webapp/ balancer://testcluster/webapp/ stickysession=JSESSIONID
 <Proxy balancer://testcluster>
        # r0
        BalancerMember ajp://192.168.100.10:8009 loadfactor=1 route=r0
        # r1
        BalancerMember ajp://192.168.100.11:8009 loadfactor=1 route=r1
 </Proxy>

stickysession=JSESSIONIDǤJSESSIONIDʸξˤmatchʤɤʤȤtomcatCookieǤJSESSIONIDʸurlǤjsessionidȾʸѿ̾ꤹ롣ȤCookieͭˤUAΤߤоݤˤȤǤʤCookieλȤʤѥȤʤɤ⺮ߺ礳ǤбǤʤ⺣λͤǤstickysessionʣꤹ뤳ȤǤʤ褦

ȤϤλͤapachebugzillaˤϿƤꡢԶȤǧϤƤ褦bugȤꤢpatchhttpd-2.2.4mod_proxy_balancer.c褦ˤΤ(ۤȤѤʤ)

 --- mod_proxy_balancer.c.orig   Wed May 23 11:09:16 2007
 +++ mod_proxy_balancer.c        Wed May 23 11:58:50 2007
 @@ -112,9 +112,18 @@
                              const char *name)
  {
      char *path = NULL;
 +    char *session_id = NULL;
 +    int  i;
 
 -    for (path = strstr(url, name); path; path = strstr(path + 1, name)) {
 -        path += strlen(name);
 +    session_id= apr_pstrdup(pool, name);
 +    /* Change 'JSESSIONID' to 'jsessionid' to match the value in the url */
 +    if (isupper(name[0])) {
 +      for (i=0;i<=strlen(session_id);i++)
 +       session_id[i] = tolower(session_id[i]);
 +    }
 +
 +    for (path = strstr(url, session_id); path; path = strstr(path + 1, session_id)) {
 +        path += strlen(session_id);
          if (*path == '=') {
              /*
               * Session path was found, get it's value

patchƤ뤳ȤǡȤꤢ̵ٵstickysessionʸǤmatch褦ˤƤ롣εư(ʸȾʸ̩˶̤)ԤˤpatchƤƤϤʤ

褳ȵưϤɤ٤ȤϡΤؤ󤫤ϤޤϢthreadùƤ褦ʤΤǡΥ꡼(httpd-2.2.5?)Ǥϲ餫μѹ

VirtualHost˴ؤäȤФ

VirtualHostname-basedIP-based򺮺ߤ

IPv4ɥ쥹󤷤ɡIPv6ɥ쥹Ͻ˻ȤʤɤΤäȤ⡣httpd.confϤʴˤʤ롣

 Listen 123.45.67.89:80
 Listen [2001:3e0:4eb:9999:8000]:80
 Listen [2001:3e0:4eb:9999:8001]:80
 
 NameVirtualHost 123.45.67.89:80
 
 <VirtualHost 123.45.67.89:80 [2001:3e0:4eb:9999:8000]:80>
    DocumentRoot "/home/web/example.jp/htdocs"
    ServerName www.example.jp
 </VirtualHost>
 
 <VirtualHost 123.45.67.89:80 [2001:3e0:4eb:9999:8001]:80>
    DocumentRoot "/home/web/example.com/htdocs"
    ServerName www.example.com
 </VirtualHost>

DNSϤʤ󤸤ǡ

 www.example.jp.	IN	A	123.45.67.89
 www.example.jp.	IN	AAAA	2001:3e0:4eb:9999:8000
 www.example.com.	IN	A	123.45.67.89
 www.example.com.	IN	AAAA	2001:3e0:4eb:9999:8001

IPv4ɥ쥹(Ĥ꿶ʤɥ쥹)NameVirtualHostꤹΤݥȡȤϰŻˤIPɥ쥹VirtualHostؼҤ˥ڡǶڤäƵҡ̤IPv6ʤƤ⡢IPv4Х륢ɥ쥹ϰĤʤɡץ饤١ȥɥ쥹Ϥ󤢤롢ʤƾǤ⤪ޤ

ۥȥȥ˥磻ɥɤ

Ȥexample.jpɥᥤƱVirtualHostб硣www.example.jpǤweb.example.jpǤexample.jpǤwwwwwwwwwwwwwwwwwwwwwww.example.jpǤ⡦

DNSϤ

 example.jp.	IN	A	123.45.67.89
 *.example.jp.	IN	A	123.45.67.89

httpd.confϡ

 Listen 123.45.67.89:80
 <VirtualHost 123.45.67.89:80>
    DocumentRoot "/home/web/example.jp/htdocs"
    ServerName example.jp
    ServerAlias *.example.jp
 </VirtualHost>

ServerNameϤServerAliasname-basedλHost:ꥯȥإåȥޥåơɤVirtualHostܤ뤫Ǥ롣ʸ̤ꥨꥢǥ磻ɥɤꤷƤꡢexample.jpɥᥤΤɤ̾ƤƱVirtualHostޥå롣IPv6ξŬ󥸤ޤ礦

Ф񤭤ȸäƤ2ĤפĤʤäɡޤʤ󤫳ФפФꤷ񤭤ޤ

SIGUSR1򿩤ähttpd夬äƤʤ

ˤФеꡣä


Jun 1 00:00:00 ns newsyslog[92788]: logfile turned over

[Thu Jun 01 00:00:03 2006] [notice] seg fault or similar nasty error detected in the parent process




newsyslogǥơ󤹤SIGUSR1(ʥ30)äơե뵭һҤƤɬפɡǾ夬äƤʤ



äƤߤɤPHP4äݤʷϵФƤ
http://www.freebsd.org/cgi/query-pr.cgi?pr=64904
http://bugs.php.net/bug.php?id=27899
http://bugs.php.net/bug.php?id=27810

Ȥ褦ȻפΩäɡäѤ⤦̲鿲롣(Ȥäޤ֤)