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 help@mydomain.com
        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?

28

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.

| improve this answer | |
  • 12
    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 Oct 26 '12 at 10:20
  • Good for you, for starting from a hint and digging harder - that way lies excellence! – MadHatter Oct 26 '12 at 12:43
4

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.