apache2のサブディレクトリをmongrelで起動してるrailsにプロキシする

MongrelでRailsをデプロイ - shokaiの日記の続きの状態で、mongrelが4000~4004番portで起動している状態から。

http://shokai.mag.keio.ac.jp/は普通のapacheのDocumentRoot以下で見せておいて、
http://shokai.mag.keio.ac.jp/shiritori/以下だけをmongrelで起動してるrailsにproxyする
つまりVirtualHostは使わない。

sudo a2enmod proxy_balancer 
sudo a2enmod proxy
sudo a2enmod proxy_http

/etc/apache2/conf.d/shiritori.conf

ProxyPreserveHost Off
ProxyRequests Off

<Proxy *>
  Order deny,allow
  Allow from all
</Proxy>

ProxyPass /shiritori balancer://shiritori
ProxyPassReverse /shiritori balancer://shiritori

<Proxy balancer://shiritori>
  BalancerMember http://127.0.0.1:4000/shiritori loadfactor=10
  BalancerMember http://127.0.0.1:4001/shiritori loadfactor=10
  BalancerMember http://127.0.0.1:4002/shiritori loadfactor=10
  BalancerMember http://127.0.0.1:4003/shiritori loadfactor=10
  BalancerMember http://127.0.0.1:4004/shiritori loadfactor=10
</Proxy>

/etc/apache2/mods-available/proxy.conf

<IfModule mod_proxy.c>
        ProxyRequests Off

        <Proxy *>
               Order deny,allow
               Allow from all
        </Proxy>

</IfModule>

apache再起動

sudo /etc/init.d/apache2 restart

public/index.html のあたりを書き換える