domingo, 26 de octubre de 2014

deploying Apache2+WebDAV on Ubuntu

WebDAV is a web authoring built into HTTP that allows to share files and work collaborative .

So, To enable it there are several steps, here they are:

1. enable the appropriated modules:
sudo a2enmod dav
sudo a2nemod dav_fs

2. restart apache:
  sudo servide apache2 restart

3. Then we need to create a directory, it would be great whether this one is outside the DocumentRoot directory, i will create it on /home:
  mkdir /home/me/webdav

4. To gain access from web we need to change the owner to www-data
   chown www-data /home/me/webdav

5. Next, we need to password protect the target directory:
  sudo htpasswd -c /etc/apache2/webdav.password me
  sudo chown root:www-data /etc/apache2/webdav.password
  sudo chmod 640 /etc/apache2/webdav.password

6. Cool, now we need to configure apache to use WebDAV, I will modify the default site configuration file:

Alias /webdav /home/me/webdav


   Order allow,deny
  Allow from all



    Options Indexes
    DAV On
    AuthType Basic
    AuthName "webdav"
    AuthUserFile /etc/apache2/webdav.password
    Require valid-user


7. At this time, we may try our advance, so from a web browser type:
    http://localhost/webdav

  You will be asked for a user and a password

 You might try it using a WebDAV client called cadaver, like this:
  cadaver http://localhost/webdav

8. for security reasons, we may disable the Directory Listing (removing the line Options Indexes) and instead, we may create an html file ( it is mandatory to named index.html), like this:



Main Page

this is the first page displayed once the directory listing is off



save it on /home/me/webdav, restart apache and try to access it

Next, I will write about how to use it in a production environment.

Best

No hay comentarios:

Publicar un comentario