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.
- File Uploads via WebDAV: Securely upload files to a specified directory.
- Directory Listing in JSON: View files and directories in a simple JSON format.
- File Downloads: Easily download files via HTTP.
- Authentication: Secure access with HTTP Basic Authentication.
- Flexible Deployment: Easily configurable using environment variables.
-
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:
- URL:
http://localhost:8080/upload/
- Username and Password: The credentials you set in the environment variables (
WEBDAV_USER
,WEBDAV_PASSWORD
).
- URL:
-
View directory structure in JSON format:
- URL:
http://localhost:8080/files/
- The output will display the files and directories in JSON format.
- URL:
-
Download files:
- URL: http://localhost:8080/files/filename
- Replace
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.