I am attempting to configure Apache to host multiple django sites via mod_wsgi. The mod_wsgi setup tutorial gives an example configuration for this scenario where each app is in the same directory:
WSGIScriptAliasMatch ^/([^/]+) /usr/local/django/$1/apache/django.wsgi
<DirectoryMatch ^/usr/local/django/([^/]+)/apache>
Order deny,allow
Allow from all
</DirectoryMatch>
I'm trying to extend this example to add a password file created for each application to use http authentication. I figured I could do this by setting up a seperate parallel directory for each app and reference the matched directory name in the way that is done in WSGIScriptAliasMatch, like such:
WSGIScriptAliasMatch ^/([^/]+) /usr/local/django/$1/apache/django.wsgi
<DirectoryMatch ^/usr/local/django/([^/]+)/apache>
AuthType Basic
AuthUserFile /usr/local/django-auth/$1/users.passwd
AuthGroupFile /dev/null
Require valid-user
</DirectoryMatch>
I had assume that '$1' would expand to the parans matched by the regex for the DirectoryMatch, however I can't authenticate and my error log states:
No such file or directory: Could not open password file: /usr/local/django-auth/$1/users.passwd
So it seems like the '$1' isn't being expended to the matched app like I assumed it would. Is there any way to accomplish this? I don't want to have to add a new directive for each site as it pops up.