Re: Apache 2 + mod_perl + virtual host problems

[prev] [thread] [next] [Date index for 2005/02/21]

From: Leo
Subject: Re: Apache 2 + mod_perl + virtual host problems
Date: 14:49 on 21 Feb 2005
This is a multi-part message in MIME format.
--------------060707070907040903030406
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Bruno:

If you use public_html for each user, you might be able to configure a 
cgi-bin directory therein for testing such "dirty scripts" .

This is a modification of the default configuration of Apache2 on Gentoo...

<IfModule mod_perl.c>
    <Directory /home/*/public_html/cgi-bin>
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        Options +ExecCGI
        <IfDefine MODPERL2>
          PerlOptions +ParseHeaders
        </IfDefine>
        <IfDefine !MODPERL2>
          PerlSendHeader On
        </IfDefine>
    </Directory>
</IfModule>

If you really need virtual hosts and have mod_vhosts_alias try this 
config modified from gentoo virtual_homepages.conf
It assumes your virtual hosts are at /www/hosts

See the documentation for mod_vhost_alias for details.

#A virtually hosted homepages system
#
#   This is an adjustment of the above system tailored for an ISP's
#   homepages server. Using a slightly more complicated configuration we can
#   select substrings of the server name to use in the filename so that e.g.
#   the documents for www.user.isp.com are found in /home/user/. It uses a
#   single cgi-bin directory instead of one per virtual host.

# get the server name from the Host: header
#UseCanonicalName Off

# include part of the server name in the filenames
VirtualDocumentRoot /www/hosts/%2/docs

# single cgi-bin directory
ScriptAlias  /cgi-bin/  /www/std-cgi/

# if you are happy not using modperl for cgi scripts
# VirtualScriptAlias /cgi-bin/ /www/hosts/%2/cgi-bin/
 
# if you need modperl for cgi scripts                                  
<IfModule mod_perl.c>
    # foreach virtual host repeat the following
    <Directory /www/hosts/userfred.mydomain.com/cgi-bin>
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        Options +ExecCGI
        <IfDefine MODPERL2>
          PerlOptions +ParseHeaders
        </IfDefine>
        <IfDefine !MODPERL2>
          PerlSendHeader On
        </IfDefine>
    </Directory>
    ...
</IfModule>

Also you may have to modify your VirtualDocumentRoot and 
VirtualScriptAlias or the PerlRun Directory configs to reflect the real 
location of your virtual domains.

Be sure your DNS is configured with all the virtual hosts you need.

Also note that I haven't tested any of these configs with debian 
Apache2. But maybe it will give you a starting point.

please correct me where I may have made errors.

Leo

Bruno Lavoie wrote:

>Hello,
>
>my problem is very confusing! and i absolutely need it working!
>at work i need to configure multiples developement zone under apache 2
>and mod_perl 2, and this as virtual host for each programmer. I need
>to run environement in ModPerl::PerlRun because we have dirty scripts
>that doesnt work under ModPerl::Registry
>
>i'm running on a debian box with :
>
>Apache/2.0.52 (Debian GNU/Linux) PHP/4.3.10-2 mod_perl/1.999.20 Perl/v5.8.4
>
>and here is my virtual host settings :
>
>
><VirtualHost *>
>
>        ServerName      developername.domain.com
>        ServerAdmin     my@xxxx.xxxxxx
>        ServerSignature On
>
>        LogLevel  warn
>        ErrorLog  /fsg/intranet-fsgbla/logs/apache-error.log
>        CustomLog /fsg/intranet-fsgbla/logs/apache-common.log common
>
>        DocumentRoot /fsg/intranet-fsgbla/htdocs/
>
>
>        PerlModule Apache2
>        PerlModule ModPerl::PerlRun  
>        PerlOptions +Parent
>        PerlSwitches -Mlib=/fsg/intranet-fsgbla/htdocs
>
>        <Files ~ ".pl$">
>                SetHandler perl-script
>                PerlResponseHandler ModPerl::PerlRun
>                PerlOptions +ParseHeaders
>                Options +ExecCGI
>        </Files>
>
>        <Location /perl-status>
>                SetHandler perl-script
>                PerlHandler Apache::Status
>        </Location>
>
></VirtualHost>
>
>
>
>
>the weirdest thing is the PerlResponseHandler ModPerl::PerlRun in the
><Files ~ ...> directives scope dont call scripts, my error log show me
>when i call a .pl file :
>Code:
>
>[Thu Feb 17 10:02:55 2005] [error] /fsg/intranet-fsgbla/htdocs/test.pl
>not found or unable to stat
>
>
>
>when i change the ModPerl::PerlRun to ModPerl::Registry, IT WORKS? no
>errors in error log file! WHY?
>
>i tried a lot of thing and i'm very out of ideas?
>
>someone knows it?
>
>thanks a lot
>Bruno
>
>
>  
>


--------------060707070907040903030406
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Bruno:<br>
<br>
If you use public_html for each user, you might be able to configure a
cgi-bin directory therein for testing such "dirty scripts" .<br>
<br>
This is a modification of the default configuration of Apache2 on
Gentoo...<br>
<br>
<small><font face="Courier New, Courier, monospace">&lt;IfModule
mod_perl.c&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;Directory /home/*/public_html/cgi-bin&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetHandler perl-script<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PerlResponseHandler ModPerl::PerlRun<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Options +ExecCGI<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;IfDefine MODPERL2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PerlOptions +ParseHeaders<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/IfDefine&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;IfDefine !MODPERL2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PerlSendHeader On<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/IfDefine&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/Directory&gt; <br>
&lt;/IfModule&gt;</font></small><br>
<br>
If you really need virtual hosts and have mod_vhosts_alias try this
config modified from gentoo virtual_homepages.conf<br>
It assumes your virtual hosts are at /www/hosts<br>
<br>
See the documentation for mod_vhost_alias for details.<br>
<br>
<font face="Courier New, Courier, monospace"><small>#A virtually hosted
homepages system<br>
#<br>
#&nbsp;&nbsp; This is an adjustment of the above system tailored for an ISP's<br>
#&nbsp;&nbsp; homepages server. Using a slightly more complicated configuration
we can<br>
#&nbsp;&nbsp; select substrings of the server name to use in the filename so that
e.g.<br>
#&nbsp;&nbsp; the documents for <a class="moz-txt-link-abbreviated" href="http://www.user.isp.com">www.user.isp.com</a>; are found in /home/user/. It
uses a<br>
#&nbsp;&nbsp; single cgi-bin directory instead of one per virtual host.<br>
<br>
# get the server name from the Host: header<br>
#UseCanonicalName Off<br>
<br>
# include part of the server name in the filenames<br>
VirtualDocumentRoot /www/hosts/%2/docs<br>
<br>
# single cgi-bin directory<br>
ScriptAlias&nbsp; /cgi-bin/&nbsp; /www/std-cgi/<br>
<br>
# if you are happy not using modperl for cgi scripts<br>
# VirtualScriptAlias /cgi-bin/ /www/hosts/%2/cgi-bin/<br>
&nbsp; <br>
# if you need modperl for cgi scripts &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&lt;IfModule mod_perl.c&gt;<br>
&nbsp;&nbsp;&nbsp; # foreach virtual host repeat the following<br>
&nbsp;&nbsp;&nbsp; &lt;Directory /www/hosts/userfred.mydomain.com/cgi-bin&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetHandler perl-script<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PerlResponseHandler ModPerl::PerlRun<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Options +ExecCGI<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;IfDefine MODPERL2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PerlOptions +ParseHeaders<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/IfDefine&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;IfDefine !MODPERL2&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PerlSendHeader On<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/IfDefine&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/Directory&gt; <br>
&nbsp;&nbsp;&nbsp; ...<br>
&lt;/IfModule&gt;<br>
</small></font><br>
Also you may have to modify your VirtualDocumentRoot and
VirtualScriptAlias or the PerlRun Directory configs to reflect the real
location of your virtual domains.<br>
<br>
Be sure your DNS is configured with all the virtual hosts you need.<br>
<br>
Also note that I haven't tested any of these configs with debian
Apache2. But maybe it will give you a starting point.<br>
<br>
please correct me where I may have made errors.<br>
<br>
Leo<br>
<br>
Bruno Lavoie wrote:
<blockquote cite="mid6d4854430502210540a841255@xxxx.xxxxx.xxx"
 type="cite">
  <pre wrap="">Hello,

my problem is very confusing! and i absolutely need it working!
at work i need to configure multiples developement zone under apache 2
and mod_perl 2, and this as virtual host for each programmer. I need
to run environement in ModPerl::PerlRun because we have dirty scripts
that doesnt work under ModPerl::Registry

i'm running on a debian box with :

Apache/2.0.52 (Debian GNU/Linux) PHP/4.3.10-2 mod_perl/1.999.20 Perl/v5.8.4

and here is my virtual host settings :


&lt;VirtualHost *&gt;

        ServerName      developername.domain.com
        ServerAdmin     <a class="moz-txt-link-abbreviated" href="mailto:my@xxxx.xxxxxx">my@xxxx.xxxxxx</a>;
        ServerSignature On

        LogLevel  warn
        ErrorLog  /fsg/intranet-fsgbla/logs/apache-error.log
        CustomLog /fsg/intranet-fsgbla/logs/apache-common.log common

        DocumentRoot /fsg/intranet-fsgbla/htdocs/


        PerlModule Apache2
        PerlModule ModPerl::PerlRun  
        PerlOptions +Parent
        PerlSwitches -Mlib=/fsg/intranet-fsgbla/htdocs

        &lt;Files ~ ".pl$"&gt;
                SetHandler perl-script
                PerlResponseHandler ModPerl::PerlRun
                PerlOptions +ParseHeaders
                Options +ExecCGI
        &lt;/Files&gt;

        &lt;Location /perl-status&gt;
                SetHandler perl-script
                PerlHandler Apache::Status
        &lt;/Location&gt;

&lt;/VirtualHost&gt;




the weirdest thing is the PerlResponseHandler ModPerl::PerlRun in the
&lt;Files ~ ...&gt; directives scope dont call scripts, my error log show me
when i call a .pl file :
Code:

[Thu Feb 17 10:02:55 2005] [error] /fsg/intranet-fsgbla/htdocs/test.pl
not found or unable to stat



when i change the ModPerl::PerlRun to ModPerl::Registry, IT WORKS? no
errors in error log file! WHY?

i tried a lot of thing and i'm very out of ideas?

someone knows it?

thanks a lot
Bruno


  </pre>
</blockquote>
<br>
</body>
</html>

--------------060707070907040903030406--

(message missing)

Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 13:40 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Leo 14:49 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 14:58 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Perrin Harkins 18:13 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 18:31 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Perrin Harkins 18:38 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Stas Bekman 01:39 on 22 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 15:11 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Perrin Harkins 18:09 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 18:54 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Perrin Harkins 19:42 on 21 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Stas Bekman 01:49 on 22 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 02:28 on 22 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Stas Bekman 02:40 on 22 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 02:53 on 22 Feb 2005

Re: Apache 2 + mod_perl + virtual host problems
Bruno Lavoie 04:41 on 22 Feb 2005

Generated at 12:48 on 22 Feb 2005 by mariachi v0.52