Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Don't ask to ask, just ask
 
PerlMonks  

Plack and mod_fcgid

by morgon (Chaplain)
on Sep 26, 2011 at 11:11 UTC ( #927837=perlquestion: print w/ replies, xml ) Need Help??
morgon has asked for the wisdom of the Perl Monks concerning the following question:

Hi

Sorry for abusing this forum as my problem is more of an apache-configuration isse but maybe the answer could be useful to other people as well...

I have a Plack-application that I want to run as fast-cgi under apache using mod_fcgid and I cannot figure out how to do this.

What I want is that all urls starting with "/foo" to be handled by this Plack-app.

The first line of my app looks like this:

#!<full path to plackup> -s FCGI
And I have added the following to the apache-config file:
<Location "/foo"> FcgidWrapper "<path to plack-app>" virtual </Location>
But it does not work - apache says file "/var/www/foo" does not exist, so evidently I am doing it totally wrong...

Can someone help me here?

Many thanks!

Comment on Plack and mod_fcgid
Select or Download Code
Re: Plack and mod_fcgid
by sundialsvc4 (Monsignor) on Sep 26, 2011 at 12:36 UTC

    You are probably missing a SetHandler directive.   Look at the second example in the Apache documentation for mod_fcgid carefully.

    I am more familiar with mod_fcgi but I expect that the situation will be similar...

    There are really two ways that Apache is designed to operate:   (1) for shared-hosting companies; and (2) for dedicated corporate servers.   In the first scenario, “anyone out there” could request to run “a CGI program” ... except that we want it to run under fast-CGI.   As long as the SetHandler fcgid-script directive or the SetHandler directive is used appropriately, the Apache module tries to do all the rest.   It “runs the file,” just as CGI does, but it (so to speak...) tries to harbor them for a while.

    Another way to do FastCGI (as I use mod_fastcgi) is to establish a static or dynamic server and then to cause the <Location> directive to refer to it.   This is the second scenario I described.   In this case, Apache isn’t looking for “a file to run.”   Instead, the server processes are running (under Apache’s auspices or not... on the current machine or not...) and Apache is forwarding selected requests to them.   In this scenario, the identity and the number of handlers is well-known to you and stable (whereas, in the first, it could be so-to-speak unpredictable).

    Throughout all of this, the Plack portion of it all is relatively easy:   it’s basically app.psgi.

    I have very-recent experience with a FastCGI deployment and would be happy to help further, if this initial, admittedly-vague response to this thread has been useful for setting the stage ...

      Thanks for your reply.

      I have also tried:

      <Location "/foo"> FcgidWrapper "<path to script-dir>/app.psgi" .psgi virtual AddHandler fcgi-script .psgi </Location>
      But that does not change a thing...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-04-17 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (443 votes), past polls