Red Hat / CentOS Linux: Apache Enable WebDAV

To enable WebDAV support in Apache on Red Hat or CentOS Linux, you can follow these steps:

  1. Install the mod_dav and mod_dav_fs Apache modules by running the following command as root:
    yum install mod_dav mod_dav_fs
  2. Create a directory where you want to store the WebDAV-enabled files, for example:
    mkdir /var/www/webdav
  3. Set the appropriate ownership and permissions on the directory. For example, to allow the Apache user (apache) to read and write files in the directory:
    chown apache:apache /var/www/webdav
    chmod 755 /var/www/webdav
  4. Edit the Apache configuration file (/etc/httpd/conf/httpd.conf) and add the following lines at the end of the file:
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_fs_module modules/mod_dav_fs.so

    <Location /webdav>
    DAV On
    AuthType Basic
    AuthName "WebDAV"
    AuthUserFile /etc/httpd/conf/webdav.users
    Require valid-user
    </Location>

    This will enable WebDAV in Apache and create a protected WebDAV directory at /webdav. The AuthUserFile directive specifies the file containing the WebDAV user accounts and passwords. You will need to create this file and add users to it. For example, to create a user jdoe with password secret:

    htpasswd -c /etc/httpd/conf/webdav.users jdoe
  5. Restart the Apache service to apply the changes:
    service httpd restart

After completing these steps, you should be able to access the WebDAV directory by navigating to http://yourserver.com/webdav in a WebDAV client, and entering the username and password for the WebDAV user account you created.

Leave a Comment