Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Plack and multiple domains

by szabgab (Priest)
on Feb 17, 2012 at 19:02 UTC ( [id://954591]=perlquestion: print w/replies, xml ) Need Help??

szabgab has asked for the wisdom of the Perl Monks concerning the following question:

I am using Starman to host a web site. I would like to setup a couple of other domains on the same server and tell Starman to handle them. How can I do that? I think Starman cannot handle it alone so I thought I'd need a Plack::Middleware. I checked, but I could not find any that would do that. Have I missed it or do I misunderstand how this should work?

Update

I also asked on the IRC channel of Plack and they directed me to Plack::Builder which is just awesome.

Replies are listed 'Best First'.
Re: Plack and multiple domains
by chromatic (Archbishop) on Feb 17, 2012 at 19:25 UTC
Re: Plack and multiple domains
by moritz (Cardinal) on Feb 17, 2012 at 20:03 UTC

    If you don't want to change any application code, you could have separate instances of Starman listening at different ports, and then have a user-facing Apache instance that runs a reverse proxy for each subdomain.

    I use a similar setup for a host that started off with only Apache, and now forwards some domains to a Mojolicious application, and it works fine.

      If you don't want to change any application code, you could have separate instances of Starman listening at different ports, and then have a user-facing Apache instance that runs a reverse proxy for each subdomain.

      Or you could have a user-facing ngix/lighthttpd/perlbal instance that runs a reverse proxy for each subdomain :) Plack::Middleware::ReverseProxy

      example reverse proxy config for apache/apache2/ngix/lighthttpd http://www.omakase.org/perl/starmanreverseproxyab.html

      Perlbal / http://wiki.catalystframework.org/wiki/deployment/perlbal-starman-psgi

Re: Plack and multiple domains
by Anonymous Monk on Feb 17, 2012 at 19:21 UTC

    I think its just a matter of using

    --listen localhost --listen localpost --listen localfoobar
    and then having some Plack::App::URLMap dispatch apps based on Host: header ( PSGI SERVER_NAME or HTTP_HOST var)
    $urlmap->map( "http://localhost/" => $app1); $urlmap->map( "http://localpost/" => $app2); $urlmap->map( "http://localfoobar/" => $app3);

    I'm not sure you need the multiple --listen options if all the hostnames bind to the same IP

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://954591]
Approved by philipbailey
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-03-19 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found