一、首先启用apache的webadv的module
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/dav.load dav.load
sudo ln -s ../mods-available/dav_fs.conf dav_fs.conf
sudo ln -s ../mods-available/dav_fs.load dav_fs.load
sudo ln -s ../mods-available/dav_lock.load dav_lock.load
二、在/etc/apache2/ports.conf中增加
sudo vim /etc/apache2/ports.conf
Listen 8088
三、在/etc/apache2/sites-enabled/000-default.conf中增加
sudo vim /etc/apache2/sites-enabled/000-default.conf
DAVLockDB ${APACHE_LOCK_DIR}/DAVLock
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:8088>
ServerName webdav
ServerAdmin webmaster@localhost
DocumentRoot /home/pi/Public
Alias /webdav /home/pi/Public
<Directory /home/pi/Public>
Dav On
Options +Indexes
IndexOptions FancyIndexing
AddDefaultCharset UTF-8
AuthType Basic
AuthName "webdav"
AuthUserFile /etc/webdav.passwd
Require valid-user
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
转载请注明:
https://www.kalet.cn/post/819.html
四、修改webdav密码
sudo htpasswd -c /etc/webdav.passwd webdav
五、修改权限
sudo chown -R www-data:www-data /home/pi/Public
六、重启apache
sudo /etc/init.d/apache2 restart