Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Configuring Starman a la Apache

by punkish (Priest)
on Mar 07, 2011 at 14:48 UTC ( #891817=perlquestion: print w/ replies, xml ) Need Help??
punkish has asked for the wisdom of the Perl Monks concerning the following question:

I have been a long-time Apache user exclusively, but am beginning to experiment with some of the new web servers. Specifically, I am looking at Starman (but the same question would apply to HTTP::Server::PSGI or HTTP::Server::Simple).

How do I configure Alias /lib /path/to/lib for Starman?

I store all my JavaScript libraries under /path/to/lib, and an Alias as above in my httpd.conf allows me to include these JS files within my various VirtualHost configurations no matter what their base URL.

I can't figure out how to accomplish the same effect with Starman, and I can't find any documentation for this as well. Any help would be much appreciated, even if it means learning that this can't be done.



when small people start casting long shadows, it is time to go to bed

Comment on Configuring Starman a la Apache
Select or Download Code
Re: Configuring Starman a la Apache
by Corion (Pope) on Mar 07, 2011 at 15:15 UTC

    You will need to understand PSGI then. Basically you do your own dispatch under PSGI, so depending on how you dispatch, the answer for aliases will vary too.

    If you cannot (or don't want to) change your underlying PSGI application, take a look at Plack::Middleware::Rewrite by Aristotle, which might be enough for aliasing requests to two URLs.

Re: Configuring Starman a la Apache
by Anonymous Monk on Mar 07, 2011 at 15:23 UTC
Re: Configuring Starman a la Apache
by Your Mother (Canon) on Mar 07, 2011 at 17:13 UTC

    Probably you want to continue to use apache, or nginx, or lighttpd. You'd set them up to serve all the static content and proxy a location to your starman app.There are *many* resources online for this but none I could find that seems authoritative or comprehensive. So, I'd recommend Googling around for proxy + {your server of choice here} + starman (or maybe Catalyst or plack or Dancer or Mojolicious). Starman is just the engine so any plack engine or backend critter will lead to documents that will be relevant.

    Starman is actually (surprisingly) fast so you could use it to serve static content etc for a small-medium site (with appropriate hardware/RAM) if you wanted to. The dispatch comments already given apply of course.

Re: Configuring Starman a la Apache
by miyagawa (Chaplain) on May 08, 2011 at 09:51 UTC
    Given $app is your PSGI app:
    use Plack::Builder; builder { enable "Static", path => sub { s!^/lib/!! }, root => "/path/to/lib +/"; $app; };
    See perldoc Plack::Builder and Plack::Middleware::Static for more details.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-08-01 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (1 votes), past polls