Apache配置webdav
1. 启动Apache的dav服务
1 2 |
a2enmod dav_fs a2enmod dav |
2. 重新启动Apache
1 |
/etc/init.d/apache2 restart |
3. 创建文件夹, 并把文件夹的权限改为777, 文件夹的分组和所有者 都改为 www-data
1 2 3 |
mkdir -p 文件夹;路径 chown www-data:www-data 文件夹名称 chmod -R 777 文件夹的路径 |
4. 新建webdav.conf的文件
1 2 3 4 |
cd /etc/apache2/conf-available/ vim webdav.conf #vim 加入一下内容 Include /etc/apache2/webdav.d/*.conf |
5. 引入 webdav的配置文件, 并将web.dav 使用软连接 连接到conf-enabled文件夹中
1 2 |
cd /etc/apache2/conf-enabled/ ln -s ../conf-available/webdav.conf ./ |
6. 新建 webdav.d文件夹, 存放webdav的配置文件
1 |
mkdir -p /etc/apache2/webdav.d |
7. 新建all.set 和 upload.conf 的配置文件
7.1 all.set
1 2 3 4 5 6 7 8 9 |
DAV On php_admin_value engine off AllowOverride None Order Allow,Deny Allow from all AuthType Basic AuthName "anheng" AuthUserFile "/etc/apache2/user.passwd" Options Indexes |
7.2 temp.conf
1 2 3 4 5 6 7 |
alias /GMSY_1 /home/upload/GMSY_1 <Directory "/home/upload"> include "/etc/apache2/webdav.d/all.set" require valid-user options +indexes </Directory> |
8. 新建用户
1 2 3 4 5 |
# 创建第一个账号(密码文件不存在) htpasswd -c /etc/apache2/user.passwd root # 新增用户 # 创建第二个账号(不使用-c因为密码文件已存在) htpasswd -m /etc/apache2/user.passwd anheng # 新增用户 htpasswd -D /etc/apache2/user.passwd anheng # 删除用户 |
9. 重启 Apache的服务器