Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save christopher-baek/beaf097945052948057ef6e118d4ad7e to your computer and use it in GitHub Desktop.
Save christopher-baek/beaf097945052948057ef6e118d4ad7e to your computer and use it in GitHub Desktop.
Apache WebDAV Configuration Example

Apache WebDAV Configuration Example

# install apache
sudo apt-get install apache2
# create a directory to use
sudo mkdir /var/www/webdav
sudo chown -R www-data:www-data /var/www/webdav
# enable modules
sudo a2enmod dav
sudo a2enmod dav_fs
sudo a2enmod dav_lock
# add lock to Apache virtual host configuration
DavLockDB /var/www/DavLock
# add alias in virtual host
Alias /webdav /var/www/webdav
<Directory /var/www/webdav>
DAV On
</Directory>
# install utils to create digest authentication
sudo apt-get install apache2-utils
# create the password file
# -c is create for the first time
# first param is realm, second is username
sudo htdigest -c /etc/apache2/users ${REALM} ${USERNAME}
# make the file readable
sudo chown www-data:www-data /etc/apache2/users
# add block to configuration
AuthType Digest
AuthName "webdav"
AuthUserFile /etc/apache2/users.password
Require valid-user
# enable digest
sudo a2enmod auth_digest
sudo service apache2 restart
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dav_fs.c>
DavLockDB /var/www/webdav/lock
Alias /webdav /var/www/webdav/data
<Directory /var/www/ubuntu2/webdav/data>
DAV On
</Directory>
</IfModule>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment