15

I'm unsure as to why I'm getting the following error when apache is rebooted:

Invalid command 'VirtualDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration Action 'start' failed.

The snippet it is referring to is this:

<VirtualHost *:80>
        ServerAdmin [email protected]
        VirtualDocumentRoot /local/www/staging/%1

        ServerAlias *.staging.mydomain.com
</VirtualHost>

I assumed it was a misspelling as it said, but it was copied directly from another server of mine. It works perfect there. Any ideas?

2 Answers 2

29

The documentation suggests that the directive is provided by the module vhost_alias. You should ensure that you have the

LoadModule vhost_alias_module modules/mod_vhost_alias.so

configuration directive in the configuration file of the server where it doesn't work.

2
  • 15
    Thank you very much! That helped me solve it. The code you posted didn't work directly, but I loaded the module using: a2enmod vhost_alias
    – andy
    Commented Oct 26, 2012 at 10:20
  • Good for you, for starting from a hint and digging harder - that way lies excellence!
    – MadHatter
    Commented Oct 26, 2012 at 12:43
6

I had the same error as Andy provided, but in my case, the situation is a bit different. And from the answer of MadHatter, I could devise the problem.

My apache2 server was a bit different. It has 2 directories namely /etc/apache2/mods-available & /etc/apache2/mods-enabled. Within directory mods-available you'll see a list of loadable module config file, in this case, I see a file named vhost_alias.load which contains the configuration as

LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so

So that, I used below command to enable this configuration:

sudo a2enmod vhost_alias

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .