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.

I am using an Apache server within an intranet to give access to reports. I want, with the same servername, to map a server path to a different documentroot that happens to be a file share.

Is this feasible with a VirtualHost ?

<VirtualHost *:80>
    ServerPath /path1
    DocumentRoot remote-share
    ServerName servername
</VirtualHost>

<VirtualHost *:80>
    ServerPath /path2
    DocumentRoot remote-share
    ServerName servername
</VirtualHost> 

<Directory /path1>
    Options Indexes
</Directory>

<Directory /path2>
    Options Indexes
</Directory>

In this case, path1 works but overrides path2 therefore path2 never works - probably because it's the same virtual host - but again, I need to have the same address, just different sub-folders mapped to different DocumentRoots.

share|improve this question
add comment

1 Answer

You could try using mod_alias and the Alias directive

<VirtualHost *:80>
  ServerName servername
  DocumentRoot /dummy/path
  Alias /path1 /path/to/mounted/fs/path1
  Alias /path2 /path/to/other/fs/path2
</VirtualHost>

See http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias for details.

share|improve this answer
add comment

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.