NAME

Toadfarm::Manual::VirtualHost - Virtual host setup

DESCRIPTION

This is an alternative to using nginx (or another web server) in front as virtual host router.

This is especially useful if already have a CDN (like http://cloudflare.com) in front.

Config

The magic part here is the "Host" HTTP header which is sent by the browser, and will route to the correct application.

{
  apps => [
    '/home/www/project1/script/app1' => {
      Host => 'app1.mydomain.com',
    },
    '/home/www/project2/script/app2' => {
      Host => 'app2.mydomain.com',
    },
  ],
  hypnotoad => {
    workers => 8,
    pid_file => '/tmp/toadfarm.pid',
    listen => [
      "http://*:8080",
    ],
  },
};

Note: Defining a default app might be an idea, in case the a browser doesn't set the "Host" header.

SEE ALSO

http://en.wikipedia.org/wiki/Virtual_host

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org