0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sabre/dav

Last updated at Posted at 2020-11-20

dockerで動かす場合

docker run -it --rm \
 -p 80:80 \
  atifsyedali/docker-sabre-dav

http://127.0.0.1/ にアクセスし、フォルダを作成し、
Explorerで http://127.0.0.1/ にアクセスすると表示される。

試しに /folder1/にほんご.txtを作成すると以下に保存される。

  • /var/www/files/folder1/にほんご.txt

aa.PNG

composerでインストールする場合

composer require sabre/dav
# データの保存場所
mkdir -p /home/share/webdav/
chmod 700 /home/share/webdav/
# lockファイル用
mkdir data

利用方法

/webdav/server.php
<?php
use Sabre\DAV;

require 'vendor/autoload.php';

// データ保管場所の設定。DocumentRootは避ける
$rootDirectory = new DAV\FS\Directory('/home/share/webdav/');
$server = new DAV\Server($rootDirectory);

// このスクリプトのURI
$server->setBaseUri('/webdav/server.php');

$lockBackend = new DAV\Locks\Backend\File('data/locks');
$lockPlugin = new DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);

$server->addPlugin(new DAV\Browser\Plugin());

$server->exec();

アクセス

explorerで https://ドメイン名/webdav/server.php にアクセスすると
/home/share/webdav/が読み書きできることを確認。

認証

後で書く

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?