<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">目标:建立文件服务器供各应用间共享文件</span>
1. http 的配置
编辑 /etc/httpd/conf.d 增加 webdav.conf 文件,文件内容如下,webdav 的根目录设在 /data/webdav 下
<IfModule mod_dav.c>
Alias /webdav/ "/data/webdav/"
<Directory /data/webdav>
Options Indexes FollowSymLinks
Dav On
AddDefaultCharset UTF-8
AuthType Basic
AuthName "WebDAV Server"
AuthUserFile /etc/httpd/webdav.users.pwd
Require valid-user
Order allow,deny
Allow from all
</Directory>
</IfModule>
2. 安全性
创建 WebDav 连接用户,并输入确认密码
<pre name="code" class="html">% htpasswd -c /etc/httpd/webdav.users.pwd 用户名
如果打开了 SELinux,防止 参考 http://blog.csdn.net/im3094/article/details/3712023 需要设置
% sudo chcon -R -h -t httpd_sys_content_t /data/webdav
% sudo chown apache:apache /data/webdav
3. 创建 /data/webdav 目录
% sudo chcon -R -h -t httpd_sys_content_t /data/webdav
% sudo chown apache:apache /data/webdav
4. 测试
在浏览器中打开 http://hostname/webdav 连接成功说明配置正确,另外写文件可从 Windows 或 MacOS、Linux 上通过文件管理器 mount WebDav 到本地文件进行测试。
</pre></p><p>5. 设置 http 开机启动 , 在/etc/init.d/httpd 文件中将 chkconfig - 85 15 改成 chkconfig 235 85 15</p><p></p><pre name="code" class="html"><pre name="code" class="html">% sudo chkconfig --del httpd
% sudo chkconfig --add httpd