Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP 500 using FallbackResource and mass vhost config

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?

like image 517
Sage Gerard Avatar asked Feb 15 '23 05:02

Sage Gerard


2 Answers

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

like image 128
BenTheDesigner Avatar answered Feb 16 '23 21:02

BenTheDesigner


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.

like image 27
Jon Lin Avatar answered Feb 16 '23 19:02

Jon Lin