To enable WebDAV support in Apache on Red Hat or CentOS Linux, you can follow these steps:
- Install the
mod_dav
andmod_dav_fs
Apache modules by running the following command as root:yum install mod_dav mod_dav_fs
- Create a directory where you want to store the WebDAV-enabled files, for example:
mkdir /var/www/webdav
- 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
- 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
. TheAuthUserFile
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 userjdoe
with passwordsecret
:htpasswd -c /etc/httpd/conf/webdav.users jdoe
- 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.