Why WebDAV?
Web-based Distributed Authoring and Versioning, or WebDAV, is a set of extensions to the Hypertext Transfer Protocol (HTTP) that allows users to collaboratively edit and manage files on remote World Wide Web servers. The group of developers responsible for these extensions was also known by the same name and was a working group of the Internet Engineering Task Force (IETF).
The WebDAV protocol allows "Intercreativity," making the Web a readable and writable medium, in line with Tim Berners-Lee's original vision.[1] It allows users to create, change and move documents on a remote server (typically a web server or "web share"). This is useful for authoring the documents that a web server serves, but it can also be used for storing files on the web, so that the files can be accessed from anywhere. The most important features of the WebDAV protocol are: locking ("overwrite prevention"); properties (creation, removal, and querying of information about author, modified date, etc.); name space management (ability to copy and move Web pages within a server's namespace); and collections (creation, removal, and listing of resources). Most modern operating systems provide built-in support for WebDAV[citation needed]. With a fast network and the right client, it is almost as easy to use files on a WebDAV server as those stored in local directories.
The WebDAV working group concluded its work in March 2007, after an incremental update to RFC 2518 was accepted by the Internet Engineering Steering Group (IESG). Other extensions that were unfinished at that time, such as the BIND method, will be finished by their individual authors, independent of the formal working group.
In this mobile-computing age, more and more softwares are using WebDAV to achieve some kind of "cloud" function. I have a Ubuntu server, and I have several iPhone applications could take this advantage - so, I setup the WebDAV service on my server for them.
The following how-to are combined from two web posts: one does not cover the SSL part, the other is too much for my purpose.
- Install the proper software on the Ubuntu server
# apt-get install apache2 php5 libapache2-mod-php5 - Add Apache2 modules
# cd /etc/apache2/mods-enabled # ln -s ../mods-available/dav* . # ln -s /etc/apache2/mods-available/authn_anon.load /etc/apache2/mods-enabled/authn_anon.load - Setup authentication and add users to Apache2
# htpasswd -m -c /etc/apache2/.htpasswd USERNAMEYou can use this command to add more users later or change their passwords. Remember to remove the -c option or you'll truncate this password database file every time!
- Create the WebDAV directory in the server
# mkdir /var/www/myWebDAV # chown www-data:www-data /var/www/myWebDAV - Create a certificate authority for the Apache2 server
# mkdir /etc/apache2/ssl # cd /etc/apache2/ssl # /usr/lib/ssl/misc/CA.sh -newcafollow the instructions printed out on the screen, then
# /usr/lib/ssl/misc/CA.sh -newreqremember to put the host name of your web server after Common Name (eg, YOUR name) []:, such as host.example.com (enter)
then self-sign the certification# /usr/lib/ssl/misc/CA.sh -sign - Tweak the certification files
# chmod 400 -R /etc/apache2/ssl/* # cp newcert.pem host.example.com.pem # openssl rsa -in /etc/apache2/ssl/newkey.pem -out /etc/apache2/ssl/host.example.com.keythe last command is to remove the passphrase from the RSA private key which will stop to prompt for the passphrase when starting or restarting apache
- Configuring Apache2 to serve HTTPS pages
# nano /etc/apache2/sites-available/testwebdavedit the file with the following content, which not only enable the HTTPS but also setup the WebDAV folder
<VirtualHost _default_:443> Servername host.example.com DocumentRoot /var/www/myWebDAV CustomLog /var/log/apache2/ssl_access.log combined SSLCertificateFile /etc/apache2/ssl/host.example.com.pem SSLCertificateKeyFile /etc/apache2/ssl/host.example.com.key <IfModule mod_ssl.c> SSLEngine on SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown </IfModule> <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/var/www/myWebDAV"> Dav On AuthType Basic AuthName "USERNAME" AuthUserFile /etc/apache2/.htpasswd <Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> Require user USERNAME # Require valid-user </Limit> # Options Indexes FollowSymLinks MultiViews Options FollowSymLinks AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost>now, enable the new site file and reload Apache2
# ln -s /etc/apache2/sites-available/testwebdav /etc/apache2/sites-enabled/testwebdav # /etc/init.d/apache2 reload - Verify the things
# netstat -anpt | grep apache2you should find something like (the PID could be different, the port 80 and 443 do matter):
tcp6 0 0 :::80 :::* LISTEN 5395/apache2 tcp6 0 0 :::443 :::* LISTEN 5395/apache2 - Now, it is time to configure your software to use the WebDAV service at https://WEB_server_IP_address/. Remember, the WebDAV setup here is for single user, which means one software can only have one version of data on the server!
Should be easy. Enjoy.
[...] 3.http://en.dogeno.us/2009/03/setup-webdav-service-on-ubuntu-server-running-apache2-with-ssl/ [...]
[...] с Apache2 на основе Debian Lenny Обмен файлами с помощью WebDAV Setup WebDAV service on Ubuntu server running Apache2 with SSL Пошаговая настройка SSL для Apache Implementing and using SSL to secure HTTP [...]
Tweak the certification files
# chmod 400 -R /etc/apache2/ssl/*
# cp newcert.pem host.example.com.pem
# openssl rsa -in /etc/apache2/newkey.pem -out /etc/apache2/ssl/host.example.com.key
There is an error in the last command
-in /etc/apache2/newkey.pem should be -in /etc/apache2/ssl/newkey.pem
thx Erwan!
[...] Here is a good tutorial show you how to Setup WebDAV service on Ubuntu server running Apache2 with SSL: [...]
Be certain that the Lockfile has permissive permissions or you'll chase your tail for days trying to figure out why your WebDAV server does not work.