Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Plack and multiple domains

by szabgab (Priest)
on Feb 17, 2012 at 19:02 UTC ( #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.

Comment on Plack and multiple domains
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

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

Log In?
Username:
Password:

What's my password?
Create A New User
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? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-12-18 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (49 votes), past polls