vpath and vhosts together

Jeremy James jbj at forbidden.co.uk
Fri Feb 15 14:10:59 UTC 2008

Aaron Trevena wrote:
> On 15/02/2008, Jeremy James <jbj at forbidden.co.uk> wrote:
>> Aaron Trevena wrote:
>>  > We've got perlbal running on one of our webservers instead of apache
>>  > and now I'm working through the rest, but have a little problem..
>>  >
>>  > one webserver has 2 instances of the backend mod_perl - one live and
>>  > one staging, with only 1 ip address for the server I need to use both
>>  > vpath and vhost plugin, but they don't appear to work together - the
>>  > code for vpath pretty much explicitly states that would be the case.
>>  >
>>  > So has anybody managed to combine vhost and vpath ?
>> I did a quick patch a while back to support this - see first patch from
>>  http://lists.danga.com/pipermail/perlbal/2007-April/000436.html
> Just to confirm - in order to use vhosts and vpaths, I'd daisychain
> the selectors with the vpaths in the 2nd layer selector after applying
> the first patch ?

Yup. See totally untested imaginary example configuration below. It
might contain fewer errors than my previous attempts at posting
configuration examples...

Best wishes,

=== perlbal-chained.conf ===

# This needs chained-selectors patch to Service.pm

LOAD vhost
LOAD vpath

# Imaginary internal test server doing its own path handling
CREATE POOL test_backends
  POOL test_backends ADD

  SET role            = reverse_proxy
  SET pool            = test_backends
  SET persist_backend = off
  SET verify_backend  = off
ENABLED testproxy

# End of internal test server

# Main production system, seperating images from remote apache handling
CREATE POOL main_backends
  POOL main_backends ADD
  POOL main_backends ADD
  POOL main_backends ADD

  SET role            = reverse_proxy
  SET pool            = main_backends
  SET persist_backend = on
  SET verify_backend  = on
ENABLED mainproxy

CREATE SERVICE localimages
  SET role            = web_server
  SET docroot         = /var/imageroot/
  SET dirindexing     = off
ENABLE localimages

  SET role            = selector
  SET plugins         = vpath

  VPATH /images/.*    = localimages
  VPATH .*            = mainproxy
ENABLE mainselect

# End of Main production system

# Main listener, using vhost plugin
  SET listen          =
  SET role            = selector
  SET plugins         = vhost

  VHOST test.example.com = testproxy
  VHOST *             = mainselect

=== End of perlbal-chained.conf ===

More information about the perlbal mailing list