2019年1月13日 星期日

CentOS 7 架設 WebDAV

CentOS 7 架設 WebDAV

CentOS 7 架設 WebDAV注意事項

架設過程主要參照這篇文章:
How to Set up WebDAV with Apache on CentOS 7

由於我只是在區網下架設,所以不進行認證,因此conf檔改成以下形式:

DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/webdav/
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
        Alias /webdav /var/www/html/webdav
        <Directory /var/www/html/webdav>
            DAV On
            Order allow,deny
            Allow from all
            AuthType None
            Require all granted
            Satisfy Any
        </Directory>
</VirtualHost>

但這樣Client端會無法寫入檔案,此時在 /var/log/httpd/error.log 下會出現以下錯誤訊息:

[Sun Jan 13 20:32:34.870769 2019] [dav:error] [pid 22893] [client 192.168.2.26:63409] The locks could not be queried for verification against a possible "If:" header.  [500, #0]
[Sun Jan 13 20:32:34.870975 2019] [dav:error] [pid 22893] [client 192.168.2.26:63409] Could not open the lock database.  [500, #400]
[Sun Jan 13 20:32:34.871053 2019] [dav:error] [pid 22893] (13)Permission denied: [client 192.168.2.26:63409] Could not open property database.  [500, #1]

這是由於apache沒有寫入 /var/www/html/DavLock的權限,將DB的路徑改到其他有存取權限的地方,或是修改 /var/www/html/ 目錄的owner即可正常使用。

Written with StackEdit.

沒有留言:

張貼留言