OK. I'm pretty much an apache HTTPD noob so please bare with me.
I have an issue with serving a large amount of VirtualHosts and I was wondering if there is a more efficient way of doing things.
I'm currently using the Location directive to serve a large amount projects from different departments, over 300 projects from 19 departments in total. The structures is the same for every Location directive except for the directories the files are served from. What I currently have is a large file that looks something like this:
<VirtualHost *>
ServerName www.myserver.com
<Location /departmentA/project1>
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /usr/local/departmentA/project1/passwords
Require valid-user
</Location>
<Location /departmentA/project2>
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /usr/local/departmentA/project2/passwords
Require valid-user
</Location>
<Location /departmentB/project1>
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /usr/local/departmentA/project1/passwords
Require valid-user
</Location>
</VirtualHost>
As you can see all these structures are the same except for the paths. What I would like is of course something where I can use variables for the department and project names and just maintain a single Location directive. I assume that this is also less heavy on the server and memory.
<VirtualHost *>
ServerName www.myserver.com
<Location /$1/$2>
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /usr/local/$1/$2/passwords
Require valid-user
</Location>
</VirtualHost>
Any help is very much appreciated.