At 5:26 PM -0500 11/11/00, Jean-Michel Dault wrote:
>On Sat, 11 Nov 2000, gene wrote:
>
>>  This might be a little off-topic, but perhaps someone has
>>  dealt with this here.  I'm still trying to get the new
>>  proxified apache mod_perl set up to work.
>>
>>  First, since I have perl scripts in various places, I changed
>>  this:
>>  <IfDefine PERLPROXIED>
>>    ProxyPass              /perl/ http://127.0.0.1:8200/
>>    ProxyPassReverse       /perl/ http://127.0.0.1:8200/
>>  </IfDefine>
>>
>>  to this:
>>  <IfDefine PERLPROXIED>
>>  Rewrite on
>>  RewriteRule ^(.*\.pl)$  http://127.0.0.1:8200/$1 [P]
>>  ProxyPassReverse       /perl/ http://127.0.0.1:8200/
>>  </IfDefine>
>
>The problem with that approach is that it forwards all perl scripts to
>mod_perl, which can be a bad thing, because most scripts are not designed
>for it.
>
>That's why the mod_perl people put the scripts in /perl, so only well
>behaved scripts get run with mod_perl.
>
>>  I haven't tried that out, but I assume it would work fine for serving
>  > a single domain, but I have several name-based virtual hosts.  With the
>>  configuration above, the proxy server wouldn't know which virtual host
>>  was supposed to be responding.  I started doing some more complicated
>>  rewrite rules that would call the proxy server with the name of the
>>  virtual server, but I wasn't sure if I was on the right track with
>>  that.
>
>Maybe we could do:
><IfDefine PERLPROXIED>
>   ProxyPass              /perl/ http://$1:8200/
>   ProxyPassReverse       /perl/ http://$1:8200/
></IfDefine>
>
>And have both httpd.conf and httpd-perl.conf have the same
>"Include conf/vhosts/DynamicVhosts.conf" directive so you don't have to
>duplicate all your settings.
>
>It's just a suggestion, not tested.

I've got this setup working now.  I have a separate rewrite rule in each
of the virtual host sections.  The trick to getting the proxy server to
know which virtual host it is serving is to preserve the host info in
the port, i.e., each virtual host gets it's own port.  Below is the
configuration that I am using.  For virtual host 1, I send the proxy
requests to port 8201.  For vh 2, I use 8202, etc.  I send all perl
scripts to the apache-mod_perl, though, of course, the rewrite rules
can be changed to just do perl scripts in a specific directory.

in httpd.conf:

<VirtualHost 192.168.1.1:80>
        ServerName      www.example.com
        ServerAlias     example.com
        ServerAdmin     [EMAIL PROTECTED]

        DocumentRoot    /home/example/www/
        ErrorLog        /var/log/httpd/example/error_log
        CustomLog       /var/log/httpd/example/access_log combined

        RewriteEngine   on
        RewriteLogLevel 0
        NoCache         *
        RewriteRule     ^/(.*\.pl)$     http://127.0.0.1:8201/$1 [P,L]
        ProxyPassReverse /              http://127.0.0.1:8201/
</VirtualHost>


in httpd-perl.conf:

Listen 8201
<VirtualHost 127.0.0.1:8201>
        ServerName      www.example.com
        ServerAlias     example.com
        ServerAdmin     [EMAIL PROTECTED]

        DocumentRoot    /home/juanita/www/
        ErrorLog        /var/log/httpd/example/error_log-perl
        CustomLog       /var/log/httpd/example/access_log-perl script
</VirtualHost>

-- 

------------------------------------------------------------------
smalltime industries  brings you the latest in games, information,
art, and interplanetary transport.  Visit us at www.smalltime.com
------------------------------------------------------------------

Keep in touch with http://mandrakeforum.com: 
Subscribe the "[EMAIL PROTECTED]" mailing list.

Reply via email to