开发者

PSGI application with Apache2 using Plack::Handler::Apache2 results in 'not found'

开发者 https://www.devze.com 2023-04-11 04:59 出处:网络
first time poster, long time lurker here. Im using a tiny PSGI application in plackup, but id like to switch to Apache2 for subdomains. I run the application with \'plackup /home/ath88/work/kolle/scr

first time poster, long time lurker here.

Im using a tiny PSGI application in plackup, but id like to switch to Apache2 for subdomains. I run the application with 'plackup /home/ath88/work/kolle/script/dir.psgi -port 80'. It runs perfectly on plackup. The application is quite simple and can be found at https://github.com/ath88/Kolletilmelding/blob/master/script/dir.psgi

But, i would like to run Apache2 instead of plackup for obvious reasons. For this i want to use Plack::Handler::Apache2. My VirtualHost looks as follows:

    <VirtualHost *:80>
      ServerName aths.dk
      ServerAdmin asbjoern@gmail.com
      <Location />
        SetHandler perl-script
        PerlResponseHandl开发者_Go百科er Plack::Handler::Apache2
        PerlSetVar psgi_app /home/ath88/work/kolle/script/dir.psgi
      </Location>
    </VirtualHost>

Apache2 restarts fine. But when i attempt to visit aths.dk i mere get a 404 not found. The directory for the application is correct, since it results in a 500 Internal Error. Looking in the apache2/error.log i get this: [Irrelevant, see edit]

    [Wed Oct 05 21:32:16 2011] [notice] caught SIGTERM, shutting down
    [Wed Oct 05 21:32:17 2011] [notice] Apache/2.2.12 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations

This happens every time i restart Apache2.

I have spent 4 hours trying to debug this. I am totally mindboggled.

Edit: Turns out the SIGTERM was from stopping Apache2 for restarting. It doesn't happen when i start it. Silly me.


Maybe your setup will benefit from a reverse HTTP proxy setup.

You can start your Plack application manually, and you can bind it to 127.0.0.1:9001 instead of 127.0.0.1:80, in which case you need a privileged user ( TCP port below 1024 ).

Then a reverse HTTP proxy config that should work could be like this one:

<VirtualHost *:80>
        ServerName aths.dk
        ServerAdmin asbjoern@gmail.com

        ErrorLog /var/log/apache2/aths.dk-error.log
        TransferLog /var/log/apache2/aths.dk.log
        DocumentRoot /var/www/aths.dk
        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        ProxyPass / http://127.0.0.1:9001/
        ProxyPassReverse / http://127.0.0.1:9001/
</VirtualHost>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号