Follow the steps in this tutorial to add WebDAV, an easy to use http-based collaboration service, to your Ubuntu Apache2 server.
Web Distributed Authoring and Versioning (WebDAV) is an extension of HTTP that enables clients to perform remote web content authoring. After WebDAV is added to an HTTP server, users can upload, download, edit, and manage files, thanks to a special readable/writable location on a web server. It's an incredibly handy means of enabling basic collaboration, without having to spend the extra cash or time setting up a specific system. If you have a Ubuntu server running Apache2, you're already close to having WebDAV.
Out of the box, Apache2 does not have WebDAV enabled, but it's an easy task to manage. Let's walk through the process of adding this feature to your system. I assume you have Apache2 running on your Ubuntu server. For this setup, I'll be installing on a Ubuntu 16.04 server with a previously installed LAMP stack.
The first thing you must do is enable the necessary modules. Open a terminal window and issue the following commands:
- sudo a2enmod dav
- sudo a2enmod dav_fs
Restart the Apache server with this command:
sudo service apache2 restart
Virtual host configuration
The next step is to create everything necessary for the virtual host. This will require creating specific directories (with specific permissions) and editing an Apache .conf file.
Let's create the necessary directories. For simplicity, I'll create a folder called webdav. From the terminal window, issue this command:
sudo mkdir -p /var/www/webdav
Now we'll change the owner of that directory to www-data with this command:
sudo chown www-data /var/www/webdav
The next step is to create a .conf file that will help make Apache2 aware of the virtual host. For this, we'll create a new .conf file called /etc/apache2/sites-available/webdav.conf. The contents of this file will be:
Options Indexes MultiViews
allow from all
Alias /webdav /var/www/webdav
Where webmaster@domain is the actual email address of the webmaster for your site. Save and close that file.
Now we copy the webdav.conf file from sites-available to sites-enabled with this command:
sudo a2ensite webdav.conf
Before restarting Apache2, we need to create the WebDAV password file with this command (USER is a valid username on your system):
sudo htpasswd -c /var/www/webdav/passwd.dav USER
When prompted enter the password for USER.
Next we must change the permissions of the newly created passwd.dav file so that only root and members of the www-data group have access to it. You'll do so with the following commands:
- sudo chown root:www-data /var/www/webdav/passwd.dav
- sudo chmod 640 /var/www/webdav/passwd.dav
Restart Apache2 with this command:
sudo service apache2 restart
The WebDAV system is ready to test.
SEE: Power checklist: Managing and troubleshooting servers (Tech Pro Research)
Testing your setup
There's an easy to use tool for testing WebDAV—install the tool with this command:
sudo apt-get install cadaver
Once installed, issue this command (IP_OF_SERVER is the actual IP address of your server):
You should be prompted for a username/password. Enter the USER used when setting up WebDAV and the associated password. If the cadaver command succeeds, you'll land at the the dav:/webdav/> prompt.
Congratulations, WebDAV is working on your Ubuntu server. You can now use whatever tool you need (connect via file managers, web browsers, etc.) to connect to your WebDAV server.
Quick and cheap collaboration
With WebDAV and Apache2, you'd be hard-pressed to find a more reliable, cost-effective collaboration tool.
- How to host multiple websites on Apache2 (TechRepublic)
- How to create a self-signed certificate to use on Apache2 (TechRepublic)
- How to install the Seafile file and sync system on Ubuntu (TechRepublic)
- How to quickly install DNS on Ubuntu with tasksel (TechRepublic)
- Ubuntu Snap takes charge of Linux desktop and IoT software distribution (ZDNet)