0

OK, the title may be a bit confuse.

I have a TrueCrypt container that gets mounted as a new drive X: on my Windows machine. Now I want my local testing Apache to deliver files from there via http://x.localhost:

<VirtualHost *:80>
    DocumentRoot "X:/htdocs"
    ServerName x.localhost
    <Directory "X:/htdocs">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

So far so good. When the TrueCrypt container is mounted, all is well. My problem starts when there is no drive 'X:' (which is unfortunately the regular case). Then, Apache refuses to start because it complains about missing folders for DocumentRoot and the <Directory> directive.

Is there a possibility to have some savvy switch implemented so that Apache does start even if no drive X: is present?

Boldewyn
  • 239
  • 4
  • 13

1 Answers1

2

Under unix, Apache will warn about a document root missing, but will still continue.

You could try:

DocumentRoot C:/
Alias / X:/htdocs
<Location "/">
    Order allow,deny
    Allow from all
</Location>

You specify a docroot that does exist. You probably want a better directory, probably one that's empty. Next we alias the root uri on top to the docroot. Finally, we use a uri based block rather than a path based block.

David Pashley
  • 23,497
  • 2
  • 46
  • 73
  • Cool, that worked. I used the Alias directive in a former try, but somehow I didn't get it right (I remember. The alias must end with a slash, that is, at least under Windows). – Boldewyn Oct 27 '09 at 11:43