{"id":333,"date":"2016-09-08T16:05:16","date_gmt":"2016-09-08T08:05:16","guid":{"rendered":"https:\/\/yyshell.com\/?p=333"},"modified":"2016-12-05T14:02:52","modified_gmt":"2016-12-05T06:02:52","slug":"centos7%e4%b8%8b%e5%ae%89%e8%a3%85apache-webdav%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/yyshell.com\/?p=333","title":{"rendered":"CentOS7\u4e0b\u5b89\u88c5Apache WebDAV\u6559\u7a0b"},"content":{"rendered":"<p>WebDAV\u53ef\u4ee5\u628ahttp\u5f53\u505a\u4e00\u4e2a\u79c1\u4eba\u201c\u7f51\u76d8\u201d\u6765\u4f7f\u7528\uff0c\u5176\u5b9e\u662f\u5f88\u65b9\u4fbf\u7684\uff0c\u800c\u4e14outlook\u7b49\u5e94\u7528\u4e5f\u652f\u6301webdav\uff0c\u771f\u7684\u5f88\u4e0d\u9519\u54df\u3002<\/p>\n<p>\u73b0\u6709\u7cfb\u7edfcentos7\u4e00\u53f0,ip192.168.42.15\/24\uff0c\u6211\u4eec\u6d4b\u8bd5\u5b89\u88c5\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>yum install httpd<\/p>\n<p>\u52a0\u5165\u5f00\u673a\u542f\u52a8<br \/>\nsystemctl enable httpd.service<\/p>\n<p>\u542f\u52a8httpd<br \/>\nsystemctl start httpd.service<\/p>\n<p>\u68c0\u6d4b\u662f\u5426\u652f\u6301dav\u6a21\u5757<br \/>\nhttpd -M | grep fs<br \/>\n\u663e\u793adav_fs_module (shared)\u8868\u793a\u5df2\u5b89\u88c5dav\u6a21\u5757<\/p>\n<p>\u5f00\u653e\u7aef\u53e3\uff1a<\/p>\n<pre class=\"lang:sh decode:true \">firewall-cmd --permanent --add-service=http\r\nfirewall-cmd --reload<\/pre>\n<p>\u5efa\u7acb\u76ee\u5f55<br \/>\nmkdir \/var\/www\/html\/webdav<br \/>\nchown apache:apache \/var\/www\/html\/webdav<\/p>\n<p>\u521b\u5efa\u65b0web\u7528\u6237webdav\uff0c\u5e76\u8f93\u5165\u7528\u6237\u5bc6\u7801<br \/>\nhtpasswd -c \/etc\/httpd\/.htpasswd webdav<\/p>\n<p>\u4fdd\u62a4\u5bc6\u7801\u6587\u4ef6\uff1a<br \/>\nchown root:apache \/etc\/httpd\/.htpasswd<br \/>\nchmod 640 \/etc\/httpd\/.htpasswd<\/p>\n<p>\u5efa\u4e2a\u65b0\u914d\u7f6e\u6587\u4ef6\uff1a<br \/>\nvim \/etc\/httpd\/conf.d\/webdav.conf<br \/>\n\u5185\u5bb9\uff1a<\/p>\n<pre class=\"lang:apache decode:true \">DavLockDB \/var\/www\/html\/DavLock\r\n&lt;VirtualHost *:80&gt;\r\n        ServerAdmin xxy@yyshell.com\r\n        DocumentRoot \/var\/www\/html\/webdav\/\r\n    ErrorLog \/var\/log\/httpd\/error.log\r\n    CustomLog \/var\/log\/httpd\/access.log combined\r\n        Alias \/webdav \/var\/www\/html\/webdav\r\n        &lt;Directory \/var\/www\/html\/webdav&gt;\r\n            DAV On\r\n            AuthType Basic\r\n            AuthName \"webdav\"\r\n#           AddDefaultCharset utf-8\r\n            IndexOptions Charset=utf-8\r\n            AuthUserFile \/etc\/httpd\/.htpasswd\r\n            Require valid-user\r\n        &lt;\/Directory&gt;\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>\u91cd\u542fApache\uff1a<br \/>\nsystemctl restart httpd.service<\/p>\n<p>\u7528webdav\u5ba2\u6237\u7aef\u65b0\u5efa\u6587\u4ef6\u5939\uff0c\u53d1\u73b0500 Internal Server Error\uff0c\u67e5\u770berror.log<\/p>\n<blockquote><p>[Thu Sep 08 15:47:38.444472 2016] [dav:error] [pid 3267] [client 192.168.42.81:54584] The locks could not be queried for verification against a possible &#8220;If:&#8221; header. [500, #0]<br \/>\n[Thu Sep 08 15:47:38.444571 2016] [dav:error] [pid 3267] [client 192.168.42.81:54584] Could not open the lock database. [500, #400]<br \/>\n[Thu Sep 08 15:47:38.444580 2016] [dav:error] [pid 3267] (13)Permission denied: [client 192.168.42.81:54584] Could not open property database. [500, #1]<\/p><\/blockquote>\n<p>\u8fd9\u662f\u56e0\u4e3aLockDB\u7684\u4e0a\u7ea7\u76ee\u5f55\u6743\u9650\u4e0d\u8db3\u5bfc\u81f4\u7684\uff0c\u6211\u4eec\u8bbe\u7f6e\u4e0b\u6743\u9650<br \/>\nchown -R apache:apache \/var\/www\/html\/<\/p>\n<p>\u7ed3\u679c\u8fd8\u4e0d\u884c!<br \/>\n\u8bbe\u7f6e\u4e0bselinux<br \/>\nsetsebool -P httpd_unified 1<\/p>\n<p>\u53d1\u73b0\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u5982\u679c\u4e0a\u4f20\u6587\u4ef6\u53d1\u73b0\u4e71\u7801\uff0c\u8bb0\u5f97\u8bbe\u7f6e\u4f20\u8f93\u7684\u65f6\u5019\uff0c\u91c7\u7528utf-8\u7f16\u7801\uff01<\/p>\n<p>\u5982\u679c\u4f60\u7684\u76ee\u5f55\u4e0d\u5728\u9ed8\u8ba4\u7684\/var\/www\/html\u76ee\u5f55\u4e0b\uff0c\u4f8b\u5982\uff0c\u4f60\u901a\u8fc7\u91c7\u7528\u4e0d\u540c\u7684\u7aef\u53e3\uff0c\u57288080\u7aef\u53e3\u4e0b\uff0c\u5f00\u901a\u4e86\u4e00\u4e2awebdav\u865a\u62df\u4e3b\u673a\uff0cwebdav\u7684\u5de5\u4f5c\u76ee\u5f55\u518d\/var\/www\/webdav\u76ee\u5f55\u4e0b\uff0c\u5982\u679c\u6309\u7167\u4e0a\u8ff0\u7684\u914d\u7f6e\uff0c \u4f60\u53ef\u4ee5\u4f1a\u9047\u5230\u5982\u4e0b\u7684\u9519\u8bef\uff1a<\/p>\n<blockquote><p>[autoindex:error] [pid 133095:tid 139787344271104] [client 192.168.42.81:56582] AH01276: Cannot serve directory \/var\/www\/webdav\/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive<\/p><\/blockquote>\n<p>\u8fd9\u4e2a\u9519\u8bef\u662f\u7531\u4e8e\u9ed8\u8ba4\u7684\u7d22\u5f15\u5bfc\u81f4\u7684\uff0c\u53ef\u4ee5\u5728VirtualHost\u7684\u914d\u7f6e\u4e2d\uff0c\u5173\u95ed\u7d22\u5f15\u5373\u53ef\u3002<\/p>\n<pre class=\"lang:apache decode:true \">DavLockDB \/var\/www\/DavLock\r\nlisten 8080\r\n&lt;VirtualHost *:8080&gt;\r\n        DirectoryIndex disabled\r\n        Options Indexes\r\n        ServerName 192.168.42.15:8080\r\n        ServerAdmin xxy@yyshell.com\r\n        DocumentRoot \/var\/www\/webdav\/\r\n    ErrorLog \/var\/log\/httpd\/error.log\r\n    CustomLog \/var\/log\/httpd\/access.log combined\r\n        Alias \/webdav \/var\/www\/webdav\r\n        &lt;Directory \/var\/www\/webdav&gt;\r\n            DAV On\r\n            AuthType Basic\r\n            AuthName \"webdav\"\r\n#           AddDefaultCharset utf-8\r\n            IndexOptions Charset=utf-8\r\n            AuthUserFile \/etc\/httpd\/.htpasswd\r\n            Require valid-user\r\n        &lt;\/Directory&gt;\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>\u8fd9\u6837\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4e0d\u540c\u7684\u7aef\u53e3\u8fdb\u884c\u8bbf\u95ee\u4e86\u3002<\/p>\n<p>linux\u547d\u4ee4\u884c\u4e0b\uff0c\u6709\u4e00\u4e2awebdav\u5ba2\u6237\u7aef\u633a\u597d\u7528\uff0c\u540d\u5b57\u53ebcadaver\uff0c\u559c\u6b22\u7684\u7528\u6237\u53ef\u4ee5\u518depel\u6e90\u4e2d\u76f4\u63a5yum\u5b89\u88c5\u4e0b\u3002<br \/>\n\u8fde\u63a5\u65b9\u6cd5\uff1acadaver http:\/\/192.168.42.15\/webdav\/<br \/>\n\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u5165\u540e\uff0c\u91cc\u9762\u7684\u5927\u90e8\u5206\u64cd\u4f5c\u548cftp\u547d\u4ee4\u884c\u5ba2\u6237\u7aef\u5f88\u50cf\uff0c\u76f8\u4fe1\u4f60\u4f1a\u4f7f\u7528ftp\u7684\u8bdd\uff0c\u5c31\u4f1a\u4f7f\u7528\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u67e5\u770b\u5e2e\u52a9\u76f4\u63a5\u8f93\u5165help\u3002<\/p>\n<h3>Windows\u4e0b\u5ba2\u6237\u7aef\u7684\u8fde\u63a5\uff1a<\/h3>\n<p>\u56e0\u4e3awindows\u81ea\u5e26\u7684webclient\u529f\u80fd\u6709\u70b9\u602a\u5f02\uff0c\u6211\u4e2a\u4eba\u63a8\u8350\u4f7f\u7528total commander\u4e0b\u7684webdav\u63d2\u4ef6\u6765\u7ba1\u7406\uff0c\u8fd9\u4e2a\u7ba1\u7406\u8d77\u6765\u6709\u70b9\u50cfftp\u5ba2\u6237\u7aef\uff0c\u975e\u5e38\u597d\u7528\u3002Windows vista\u53ca\u4ee5\u4e0a\u7684\u8f83\u65b0\u7684\u7cfb\u7edf\uff0c\u5982\u679c\u4f60\u7684webdav\u4e0d\u542f\u7528ssl\uff0c\u9ed8\u8ba4\u662f\u62d2\u7edd\u8fde\u63a5\u7684\uff0c\u9700\u8981\u6539\u4e0b\u6ce8\u518c\u8868\u3002\u66f4\u6539HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\WebClient\\Parameters\\BasicAuthLevel \u7684\u503c\u4e3a2\uff0c\u91cd\u542f\u7cfb\u7edf\uff0c\u8fd9\u65f6\u5019\u4e00\u822c\u5c31\u80fd\u8fde\u63a5\u4e0d\u52a0\u5bc6\u7684webdav\u5730\u5740\u4e86\u3002<\/p>\n<p>\u4e0d\u8fc7\uff0c\u5982\u679c\u4f60\u6d89\u53ca\u7684\u8d44\u6599\u6d89\u5bc6\uff0c\u535a\u4e3b\u4e2a\u4eba\u8fd8\u662f\u63a8\u8350\u542f\u7528ssl\u52a0\u5bc6\u94fe\u63a5\uff0c\u9632\u6b62\u88ab\u7f51\u7edc\u7a83\u542c\u3002<\/p>\n<p>&nbsp;<\/p>\n<div id=\"icibaCirclePointer\" style=\"position: absolute; top: 396px; left: -11px;\"><\/div>\n<div id=\"icibaCirclePointer\" style=\"position: absolute; top: 1865px; left: 549px;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>WebDAV\u53ef\u4ee5\u628ahttp\u5f53\u505a\u4e00\u4e2a\u79c1\u4eba\u201c\u7f51\u76d8\u201d\u6765\u4f7f\u7528\uff0c\u5176\u5b9e\u662f\u5f88\u65b9\u4fbf\u7684\uff0c\u800c\u4e14out<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[38,37,39],"class_list":["post-333","post","type-post","status-publish","format-standard","hentry","category-linux","category-web","tag-apache2-4","tag-centos7","tag-webdav"],"_links":{"self":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts\/333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=333"}],"version-history":[{"count":6,"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":426,"href":"https:\/\/yyshell.com\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions\/426"}],"wp:attachment":[{"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yyshell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}