a lightweight file upload and query server based on Nginx
227
EasyDAV is a lightweight file upload and query server based on Nginx. It allows you to upload files via WebDAV and explore the directory structure in JSON format, using an easy-to-deploy Docker setup.
Run the service using Docker directly:
docker run -d -p 8080:80 xieyanbo/easydav
Alternatively, create a docker-compose.yml file using the sample provided below:
version: "3.8"
services:
nginx-webdav:
image: xieyanbo/easydav
container_name: easydav
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- WEBDAV_USER=user
- WEBDAV_PASSWORD=pwd
volumes:
- ./data:/data
ports:
- 8080:80
restart: unless-stopped
Then, launch the service with:
docker-compose up -d
Access the WebDAV file upload interface:
http://localhost:8080/upload/WEBDAV_USER, WEBDAV_PASSWORD).View directory structure in JSON format:
http://localhost:8080/files/Download files:
filename with the actual name of the file you want to download.You can customize the service by setting the following environment variables:
WEBDAV_USER: Username for WebDAV authentication.WEBDAV_PASSWORD: Password for WebDAV authentication.PUID: Optional. User ID for file ownership.PGID: Optional. Group ID for file ownership.TZ: Timezone setting (default: Etc/UTC).You can use any WebDAV client (like curl, Cyberduck, etc.) to upload files:
curl -u user:pwd -T example.txt http://localhost:8080/upload/
# or specify the path
curl -u user:pwd -T example.txt http://localhost:8080/upload/subdir/new.txt
Access the /files/ URL to get a JSON response listing the contents of the directory:
curl -u user:pwd http://localhost:8080/files/
# or query by the dir name
curl -u user:pwd http://localhost:8080/files/subdir/
Sample JSON response:
{
"format": "json",
"autoindex": [
{
"name": "example.txt",
"type": "file",
"mtime": "Fri, 04 Oct 2024 06:49:55 GMT",
"size": 1234
},
{
"name": "subdir",
"type": "directory",
"mtime": "Fri, 04 Oct 2024 06:48:00 GMT"
}
]
}
You can directly download files that have been uploaded using a WebDAV client, or by visiting the /files/ URL followed by the file name.
For example, to download example.txt:
curl -u user:pwd -O http://localhost:8080/files/example.txt
This will download the file example.txt to your local machine.
If you need to adjust the Nginx configuration or paths, you can modify the nginx.conf file located in the ./config/nginx directory.
This project is open-source and available under the MIT License.
Content type
Image
Digest
sha256:b77347551…
Size
48.5 MB
Last updated
almost 2 years ago
docker pull xieyanbo/easydav