apache webdav

 

1.Install compulsory components.

I.Install apache2 server:

sudo apt-get install apache2

II.Enable related modules:

sudo a2enmod dav_fs

sudo a2enmod dav

sudo a2enmod dav_lock


Apache server read the symbolic links in mods-enabled folder to determine which modules to load.So we can create symbolic links to reach the same destination.

You can take ln -s command to make symbolic links of webdav related modules in mods-available folder to mods-enabled folder like this:

sudo ln -s /etc/apache2/mods-available/dav.load /etc/apache2/mods-enabled/dav.load

sudo ln -s /etc/apache2/mods-available/dav_fs.load /etc/apache2/mods-enabled/dav_fs.load

sudo ln -s /etc/apache2/mods-available/dav_lock.load /etc/apache2/mods-enabled/dav_lock.load

sudo ln -s /etc/apache2/mods-available/dav_fs.conf /etc/apache2/mods-enabled/dav_fs.conf


III.Restart apache2 server:

sudo /etc/init.d/apache2 restart


2.Create a virtual host for webdav

mkdir /home/fc/www/webdav
chown fc:fc /home/fc/www/webdav


the first fc is the default user of apache2 server.the second fc is the group of the user.The second fc is used to make the directory accessible to apache2.

3.Create users:

htpasswd -c /home/fc/www/me.dav fc

sudo chown fc:fc /home/fc/www/me.dav

sudo chmod 640 /home/fc/www/me.dav


此处 fc:为用户名,执行此句之后,会提示输入2次密码。以后登陆的时候要用到。

4.Config the virtual host:

sudo cp -a /etc/apache2/sites-available /etc/apache2/sites-available-backup

sudo gedit /etc/apache2/sites-available/default


It obvious that the first line is to backup your default settings.So you can recovery at the least cost when you failed.

Clear the existing codes in gedit and Copy the following into it.[Change the green italic parts in your own case.]

NameVirtualHost *<VirtualHost 172.16.57.67:80>        
ServerAdmin webmaster@localhost        
DocumentRoot /home/fc/www/webdav       
<Directory /home/fc/www/webdav/>                
Options Indexes MultiViews                
AllowOverride None                
Order allow,deny                
allow from all        
</Directory>        
Alias /webdav /home/fc/www/webdav        
<Location /webdav>           
DAV On           
AuthType Basic           
AuthName "webdav"          
AuthUserFile /home/fc/www/me.dav           
Require valid-user       
</Location>
</VirtualHost>

5.WebDAV it!

sudo apt-get install cadaver

cadaver http://172.16.57.67/webdav/

Or you can try it on your browser,just type :http:// your ip address/ in the address bar.
Hope you succeed!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值