Hello all,
I have been trying my hands on Apache and WebDav. User authentication works through ldap, users are locked into their own webdav directory with mod_rewrite. This setup works so far, but the user-specific webdav directory needs to be in place before a user logs on for the first time, otherwise she'll get a "404 - not found".
Is there any way to have apache check if the user-specific directory exists and to have it create that directory if it doesn't?
Hope this is the right place to ask. I'm not much of a linux specialist and the below config has been patched together from various how-to's - but it works so far.
Code:
<VirtualHost 99.99.99.99:8080>
#Basics
DocumentRoot /var/www/webdav/files
DirectoryIndex index.php
ServerName files.example.net
ServerAlias files.*
ServerAdmin www@example.net
#
#Enable SSL
SSLEngine On
SSLCertificateFile /etc/ssl/certs/example.net.crt
SSLCertificateKeyFile /etc/ssl/private/example.net.key
SSLCertificateChainFile /etc/ssl/certs/cacert.org.crt
#
#use mod-rewrite to lock users into their own webdav dir
RewriteEngine On
RewriteRule ^/(.*) /var/www/webdav/files/%{LA-U:REMOTE_USER}/$1
#
# define DAVLock location
<IfModule mod_dav_fs.c>
DavLockDB /var/lib/apache2/DAVLock
</IfModule>
<Directory /var/www/webdav/files>
#enable webdav
DAV On
ForceType text/plain
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#
# Authentication via LDAP
AuthName "Please authenticate with your_email@example.net"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPUrl "ldap://localhost/o=domains,dc=example,dc=net?mail"
AuthLDAPBindDN "cn=someadmin,dc=example,dc=net"
AuthLDAPBindPassword "*supersecretpwd*"
require valid-user
#
</Directory>
</VirtualHost>
Bookmarks