[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

apache2 <perl> sections: "*:80 has no VirtualHosts" error



the debian (sarge) incarnation of apache 2 is, according to the
readmes, reswizzled a bit from the upstream defaults... so i'll
ask this here at debian-user (maybe it's debian specific?)

okay. we're trying to use <perl> sections in apache2.conf to
configure virtual hosts -- here's Data::Dumper showing the
%VirtualHost hash:

%VirtualHost = {
  '*:80' => [
    {
      'PerlSetVar' => [
        'SiteName',
        'one'
      ],
      'Directory' => {
        '/var/www/one' => {
          'Options' => [
            '+Indexes',
          ],
          'FilesMatch' => {
            '^[A-Z]|\\.mc$' => {
              'SetHandler' => 'perl-script',
              'PerlResponseHandler' => 'Apache::NOT_FOUND'
            },
            '\\.(html|css)$' => {
              'SetHandler' => 'defaulthandler'
            }
          }
        }
      },
      'ServerName' => 'one',
      'DocumentRoot' => '/var/www/one',
      'ServerAlias' => [
        'five',
        'seven'
      ]
    },
    {
      'PerlSetVar' => [
        'SiteName',
        'three'
      ],
      'Directory' => {
        '/var/www/three' => {
          'Options' => [
            '+Indexes',
          ],
          'FilesMatch' => {
            '^[A-Z]' => {
              'SetHandler' => 'perl-script',
              'PerlHandler' => 'Apache::NOT_FOUND'
            },
            '\\.(html|css)$' => {
              'SetHandler' => 'defaulthandler'
            }
          }
        }
      },
      'ServerName' => 'three',
      'DocumentRoot' => '/var/www/three'
    }
  ]
};

site "one" has aliases "five" and "seven"; site "three" is on
its own. (we're testing, see -- /etc/hosts has all these names
as aliases for "localhost".)

when trying to use this config, apache2 belches

	NameVirtualHost *:80 has no VirtualHosts

we'd love to know why. pointers are very welcome!

===

what search terms could we use at google to get pertinent
results? we've tried

	apache2 'has no virtualhosts'

and see lots of questions similar to ours, but no definitive
answer has crossed our radar just yet...

we also encountered the source code to "vhost.c" -- and the
error message comes from function "remove_unused_name_vhosts()"
which heavily implies that when the error message shows up, the
vhost goes away... except that when we browse to

	http://three/

or

	http://five/

we GET THE SITE WE ORIGINALLY EXPECT! (this indicates that the
virtual site IS working, doesn't it?) when we visit one of the
two aliases, tho, we get the uber-root (/var/www instead of
/var/www/one).  so now we're more confused than ever. :)

====

hey!

not knowing even enough to dig a deep hole, looking at
remove_unused_name_vhosts() we see

	*pic = ic->next;

and later

	*pic = &ic->next;

is the ampersand superfluous? is this a typo?

-- 



Reply to: