forked from pool/apache2
76 lines
1.3 KiB
Plaintext
76 lines
1.3 KiB
Plaintext
|
|
#
|
|
# Example (using Digest Authentication)
|
|
#
|
|
|
|
# enable needed apache modules:
|
|
/usr/sbin/a2enmod dav
|
|
/usr/sbin/a2enmod dav_fs
|
|
|
|
# Define directory to be accesed:
|
|
davdir="editme"
|
|
# Define a location where the credentials are stored:
|
|
acldir=ACL
|
|
auth_realm=$davdir
|
|
|
|
cd /srv/www
|
|
|
|
# create a directory for WebDAV access:
|
|
mkdir $davdir
|
|
chmod 770 $davdir
|
|
chown root:www $davdir
|
|
|
|
# create the directory for the credentials:
|
|
mkdir $acldir
|
|
chmod 750 $acldir
|
|
chown root:www $acldir
|
|
|
|
# create credentials file:
|
|
touch $acldir/$davdir
|
|
chown root:www $acldir/$davdir
|
|
chmod 640 $acldir/$davdir
|
|
|
|
# set up a user accound
|
|
htdigest $acldir/$davdir $auth_realm ${user:-user1}
|
|
|
|
|
|
cat <<EOF
|
|
#
|
|
# Put this into /etc/apache2/conf.d/$davdir.conf:
|
|
#
|
|
|
|
EOF
|
|
|
|
cat <<EOF
|
|
|
|
# This directive is always needed, if you use WebDAV.
|
|
# see http://httpd.apache.org/docs-2.2/mod/mod_dav_fs.html#davlockdb
|
|
<IfModule mod_dav_fs.c>
|
|
DavLockDB /var/lib/apache2/DAVLock
|
|
</IfModule>
|
|
|
|
<IfModule mod_dav.c>
|
|
<IfModule mod_dav_fs.c>
|
|
Alias /$davdir /srv/www/$davdir
|
|
<Location /$davdir>
|
|
DAV On
|
|
#ForceType text/plain
|
|
|
|
Order Deny,Allow
|
|
Deny from all
|
|
|
|
AuthType Digest
|
|
AuthName "private area"
|
|
|
|
AuthDigestFile /srv/www/ACL/$davdir
|
|
AuthDigestDomain /$davdir/
|
|
AuthName $auth_realm
|
|
|
|
Require valid-user
|
|
Satisfy Any
|
|
</Location>
|
|
</IfModule>
|
|
</IfModule>
|
|
|
|
EOF
|