How to configure a simple WebDAV in apache
Decheng (Robbie) Fan
Modify the configuration file httpd.conf.
Firstly, allow loading modules: mod_dav and mod_dav_fs.
Secondly, write a line to create a DAV lock file:
If the path contains space, use:
DavLockDB “C:/Program Files/Apache Group/Apache2
Thirdly, add a <Directory> limiter, and make DAV on inside that directory such as:
<Directory “C:/Program Files/Apache Group/Apache2/htdocs/robbie”>
Make sure the directory is created. Then you can map it as a network drive in Windows 98 and higher versions.
Note that Windows XP map network drive functionality is quite incompatible with Apache WebDAV that almost makes it unusable. In this case, use software NetDrive (free for home use but not free for commercial use) to connect.
Windows Vista can use “map network drive” functionality safely.
After several night’s of research and looking for information online, I found the final answer for Windows XP:
- Windows XP, unlike Windows Vista, sends “domainusername” as the user name rather than merely “username”.
- Windows XP, by default uses digest authentication, and it doesn’t use basic authentication over unencrypted HTTP.
- Apache2.2 WebDAV example configuration file uses digest authentication.
- Windows XP can send “username@domain” style user name, thus avoiding the “domainusername” form.
- Apache2.2 WebDAV can configure specific users to use the DAV folder.
Summarizing the above, I use this workaround:
- Based on the Apache2.2 WebDAV example configuration file, do some modification to point it to the correct folder and use digest authentication.
- Use Apache2.2 htdigest tool (mentioned in the WebDAV example configuration file) to create user name and password for a username like username@domain.
- In the configuration file, add that user in the <LimitExcept> block to grant read-write access to the user.
- Restart Apache2.2.
- Try using Windows XP Explorer’s “Map Network Drive” feature to connect to the WebDAV to verify the configuration.
The final configuration for a read-write path that can be accessed by authorized user looks like:
Alias /incoming “E:/web”
Allow from all
# You can use the htdigest program to create the password database:
# htdigest -c “C:/Program Files/Apache Software Foundation/Apache2.2/user.passwd” DAV-upload admin
AuthUserFile “C:/Program Files/Apache Software Foundation/Apache2.2/user.passwd”
# Allow universal read-access, but writes are restricted
# to the admin user.
<LimitExcept GET OPTIONS>
require user admin
require user robbie@localhost
For a read-only path:
Alias /robbiepub “E:/web/public”
Allow from all
Notes: Windows XP is unstable with the connection, so don’t use it whenever possible. Vista (supports file timestamps) is better than NetDrive, and NetDrive is better than Windows XP. For Windows 2000 and lower, Web Folders cannot be mapped to a drive letter.
Notes: the 2009 version of NetDrive is not very stable concerning WebDAV access.