- The Perfect Server - Ubuntu 13.04 (nginx, BIND, Dovecot, ISPConfig 3)
- Ubuntu 13.04 Samba Standalone Server With tdbsam Backend
- The Perfect Server - Ubuntu 13.04 (Apache2, BIND, Dovecot, ISPConfig 3)
- How To Upgrade Ubuntu 12.10 (Quantal Quetzal) To 13.04 (Raring Ringtail) (Desktop & Server)
- Setting Up ProFTPd + TLS On Ubuntu 12.10
Simple Way To Setup WebDAV on Apache
WebDAV (Web-based Distributed Authoring and Versioning) is a way to share files over HTTP, much like you would use Samba or NFS.
It has more limitations, and less speed, than file systems like Samba or NFS, but with the proliferation of Web servers and the ability to reach Web sites from multiple clients in various locations, WebDAV certainly has its appeal. Unlike Samba or NFS, which are best suited for local area networks, you can use an HTTP server anywhere in the world and likewise access it from anywhere.
WebDAV support is also baked right into most modern operating systems (OS), making it extremely easy to access as a client. Setting it up on the server, however, may be more of a challenge. Certainly setting it up correctly can be.
Using Apache on Red Hat Enterprise Linux 5 (or CentOS 5) as an example, let's look at setting up a WebDAV server. First and foremost, you will need mod_dav and mod_dav_fs support, which can be found in the httpd package; if you have Apache installed, you will have support for WebDAV already available (other distributions may package WebDAV support modules separately, such as apache-mod_dav). The first step is to create /etc/httpd/conf.d/webdav.conf which will be where we configure WebDAV. The reason we are putting our configuration file there is due to this gem in /etc/httpd/conf/httpd.conf:
This tells Apache to automatically pick up all configuration files (*.conf) in /etc/httpd/conf.d/. The contents of /etc/httpd/conf.d/webdav.conf will look similar to this:
Alias /dav "/srv/www/dav"
This sets up the required WebDAV settings necessary to make it work properly. Here we have defined a number of things and it is important to note the location of the DavLockDB file (this must be writable by the user running Apache -- usually apache or nobody). The directory storing the lock file needs to be writable, so create a new directory specifically for this purpose:
#mkdir -p /var/dav
#chown nobody:nobody /var/dav
You will also want to ensure that /srv/www/dav is writable by the user running Apache as well:
#mkdir -p /srv/www/dav
#chown nobody:nobody /srv/www/dav
#chmod 755 /srv/www/dav
Finally, you need to create the password file for authentication. In the above example the password file was specified as /etc/httpd/conf/dav.passwd, so use htpasswd to create it:
#htpasswd -c /etc/httpd/conf/dav.passwd [user]
You will be prompted for [user]'s password and then htpasswd will create the file. At this point you can restart Apache:
#service httpd restart
You can now point a web browser to http://yoursite.com/dav/ and it should prompt you for a login. You won't be able to do anything special in the web browser, but you can use another WebDAV client to try uploading and downloading files, such as cadaver:
Authentication required for Private on server `yoursite.com':
Listing collection `/dav/': succeeded.
Coll: omnifocus 0 Aug 8 14:30
somefile.txt 115 Jul 17 15:03
For more security, wrap WebDAV up in SSL by adding it to an appropriate SSL-based virtual host. This will encrypt your password and data-in-transit.
This should also work with most other Linux distributions using Apache, possibly changing some paths to configuration files or package names. All in all, setting up WebDAV doesn't have to be difficult, but all of these steps are required, otherwise some WebDAV clients will fail with inexplicably weird errors. This also provides a quick and easy way to store files in a remote location, securely, with the ability to obtain them from anywhere.
- Infographic: New Crew Believes Job Jumping Helps Climb the Corporate Ladder
- Gearing Up for a Monumental Event: IT Connections Opens Call for Content
- Microsoft's Billion-Dollar Businesses, Past and Future
- Microsoft's "Don't fight. Switch." campaign for Windows Phone
- Fully Automate Your Quarterly Build & Capture Process