I have a rather odd problem, one which I can only assume is a bug
somewhere, due to how bizarre it is.

I am attmempting to generate virtual host configs via mod_perl, using
<Perl> sections in httpd.conf.  Not all hosts will be using a /perl
Alias, though, so I'm reading in an external config, which looks like
the following:

### Begin external vhost config #######################################
$suexec = 0;

$vhost{config} = {
  Location => {
    "/perl/" => {
      SetHandler => "perl-script",
      PerlHandler => "Apache::Registry",
      Options => "ExecCGI"
    }
  },
  Alias => [ '/perl/' => "$vhostdir/$dir/perl/" ]
};
### End external vhost config #########################################

This config is being read by the following line:
require "$vhostdir/$dir/.config" if (-r "$vhostdir/$dir/.config");

The configuration options are being added to %VirtualHost as follows:
map { $VirtualHost{$host}->{$_} = $vhost{config}->{$_} } keys(%{$vhost{config}});

Now for the oddity:
The above doesn't work.  Both Data::Dumper and Apache::PerlSections
show the options as being added to %VirtualHost, but the server never
seems to see the Alias (no idea on the Location directive, since the
Alias fails to work).  Examination of the error_log shows that the
server is trying to get htdocs/perl/, as if the Alias didn't exist.

Just to make things a bit stranger: if I add those sections directly
into my vhost code in httpd.conf, they work.  Again, Data::Dumper and
Apache::PerlSections shows what I expect (other than the options being
ordered a bit differently in the hash, but that's normal).  This is
what makes me suspect a bug, because this is so bizarre.

Included below is the output I grabbed from Apache:PerlSections in both
cases.

Any ideas?  This problem is really quite annoying.


### Working config #############################################################
%VirtualHost = (
  'linuxhelp.mirkwood.net' => {
    'Location' => {
      '/perl/' => {
        'PerlHandler' => 'Apache::Registry',
        'Options' => 'ExecCGI',
        'SetHandler' => 'perl-script'
      }
    },
    'DocumentRoot' => '/home/vhosts/linuxhelp.mirkwood.net/htdocs',
    'ServerAdmin' => 'test@vhost',
    'CustomLog' => 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.access_log combined',
    'Alias' => [
      '/perl/',
      '/home/vhosts/linuxhelp.mirkwood.net/perl/'
    ],
    'ServerName' => 'linuxhelp.mirkwood.net',
    'ErrorLog' => 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.error_log',
    'ScriptAlias' => [
      '/cgi-bin/',
      '/home/vhosts/linuxhelp.mirkwood.net/cgi-bin/'
    ],
    'ServerAlias' => 'linuxhelp'
  }
);


### Alias is broken here - WHY? ################################################
%VirtualHost = (
  'linuxhelp.mirkwood.net' => {
    'Location' => {
      '/perl/' => {
        'PerlHandler' => 'Apache::Registry',
        'Options' => 'ExecCGI',
        'SetHandler' => 'perl-script'
      }
    },
    'ScriptAlias' => [
      '/cgi-bin/',
      '/home/vhosts/linuxhelp.mirkwood.net/cgi-bin/'
    ],
    'DocumentRoot' => '/home/vhosts/linuxhelp.mirkwood.net/htdocs',
    'ServerAdmin' => 'test@vhost',
    'Alias' => [
      '/perl/',
      '/home/vhosts/linuxhelp.mirkwood.net/perl/'
    ],
    'CustomLog' => 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.access_log combined',
    'ServerAlias' => 'linuxhelp',
    'ServerName' => 'linuxhelp.mirkwood.net',
    'ErrorLog' => 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.error_log'
  }
);

-- 

        Mike Edwards

Brainbench certified Master Linux Administrator
http://www.brainbench.com/transcript.jsp?pid=158188
-----------------------------------
Unsolicited advertisments to this address are not welcome.

Reply via email to