Are you trying to create set up a WebDAV server with little effort, yet with high performance? Are you doing this for an SME, a small workgroup, or your family? Do you prefer control over your data, so Dropbox is not an option? Do you prefer raw upload and download speed to all the fancy functionality provided by personal cloud software such as ownCloud? Then the following few lines in your Apache configuration are your friends:
<Location /dav> Dav On AuthType basic AuthName "Our WebDAV Space" AuthFileName /etc/htpasswd.dav Require valid-user </Location>
(Of course, with basic authentication, you want to make sure that your server is only reachable through https, as the passwords are not secure otherwise.)
Those few lines already provides the basics, given that you have created a few users as follows:
# touch /etc/htpasswd.dav # htpasswd -s /etc/htpasswd.dav user1 # htpasswd -s /etc/htpasswd.dav user2 …
(I avoid using the -c option to htpasswd to create the passwd file initially, as this will destroy the contents of a file with the same name, had it already existed.)
/dav and all subdirectories are now writable by all your users (you have created $WEBROOT/dav, haven’t you?). Sometimes, you want to create personal directories as well:
<Location /dav/user1> Require user user1 </Location> <Location /dav/user2> Require user user2 </Location>
Do not forget to “mkdir $WEBROOT/dav/user1” etc.
To create a group directory, simply list multiple users, as shown below:
<Location /dav/group> Require user user1 user2 </Location>
In the web interface, browsing https://example.com/dav/, you will not see directories you do not have access to. However, if you use a DAV client, it will show the directories, but of course, no access will be granted inside the directories.
If you want to offer some files to the public, not requiring any password, this is just a few more lines:
<Location /dav/public> <Limit GET> Order allow,deny Allow from all Satisfy any </Limit> </Location>
It is important to limit the methods to GET, as anonymous upload rights would make your server an easy target for sharing illegal content.