1. Create webdav directory
mkdir /var/www/webdavchown apache:apache /var/www/webdav
2. Add a virtual host to apache server
vim /etc/httpd/conf/httpd.conf
NameVirtualHost *:8080
ServerAdmin webmaster@localhost
DocumentRoot /var/www/webdav/
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
DavLockDB "/tmp/DavLock"
Alias /webdav /var/www/webdav/
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/webdav/passwd.dav
Require valid-user
RewriteEngine off
3. Create webdav user
htpasswd -c /var/www/webdav/passwd.dav testUse"-c" at first time to create the passwd file
To add other users, don't use "-c" option
4. SELINUX , set the webdav folder writable by apache httpd
grep denied /var/log/audit/audit.log | grep webdavtype=AVC msg=audit(1443167688.330:3067): avc: denied { write } for pid=10689 comm="httpd" name="webdav" dev="dm-0" ino=770665 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=dir
grep "Permission denied" /var/log/httpd/error_log
[Fri Sep 25 15:54:48.332239 2015] [dav:error] [pid 10689] (13)Permission denied: [client 192.168.1.195:45679] Could not open file for writing [500, #0]
chcon -R -t httpd_sys_content_rw_t /var/www/webdav/
5. Test webdav
yum install cadaver
cadaver http://192.168.1.195:8080/webdav/
Authentication required for webdav on server `192.168.1.195':
Username: test
Password:
dav:/webdav/> exit
沒有留言:
張貼留言