문제

Context

I have Apache 2.2.15 configured for mass virtual hosting as follows:

<VirtualHost *:80>
    # ...irrelevant lines omitted
    VirtualDocumentRoot /srv/www/%-3+
    ServerName example.com
    ServerAlias localhost
</VirtualHost>

mkdir /srv/www/foo makes foo.example.com available.


Problem

HTTP 500 from all of foo.example.com when a .htaccess containing only a FallbackResource directive is in the vhost document root. Commenting out FallbackResource removes the error, but I want to use FallbackResource.


Stuff tried

I confirmed the relevant module was loaded using httpd -M | grep dir_module. Oddly enough I still see Invalid command 'FallbackResource', perhaps misspelled or defined by a module not included in the server configuration in the error log.

The filesystem is as simple as possible. There is only a "Hello, World" index.php and a .htaccess. Yes, permissions are fine.

/srv/www
    foo
        index.php <- 775, owned by apache
        .htaccess <- 664, owned by apache

I tried each of the following in .htaccess:

  • FallbackResource index.php
  • FallbackResource /index.php
  • FallbackResource foo/index.php
  • FallbackResource /foo/index.php

Also tried <Directory /srv/www/foo> even though that would not have worked anyway.

New stuff tried given comments below

  • AllowOverride Indexes raises AllowOverride not allowed here when entered into <VirtualHost> container.
  • Confirmed LoadModule dir_module modules/mod_dir.so is in httpd.conf

Anything stupid/obvious I am missing?

도움이 되었습니까?

해결책

The FallbackResource directive wasn't introduced until 2.2.16 as described here. Upgrading Apache should solve your problem.

다른 팁

In order to use FallbackResource in an htaccess file you need to allow the Indexes override. See the mod_dir documentation. Try adding the override in your vhost config:

AllowOverride Indexes

You should also try looking in apache's error logs to see what's causing the 500 server error.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top