Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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