Sign inSign up

peterberweiler/fileserver

By peterberweiler

•Updated almost 5 years ago

A download server for files with a simple folder ui and indices for downloading (e.g. via aria2)

Image
0

6.3K

peterberweiler/fileserver repository overview

[ GitHub ] ⁠       [ DockerHub ]⁠

ā šŸ“ HTTP File Server with Folder Indices (Docker Container)

nginx Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā  nodejs

A docker container that provides a http download server for files, a simple folder ui and indices for downloading (via aria2⁠ or other download managers).

The container extends the official nginx docker container⁠. Requests to folders are forwarded to the nodejs⁠ indexserver. The container processes are managed with s6-overlay⁠.

⁠Features:

  • An easy UI to navigate the folders
  • Easy download with aria2⁠, just add ?aria2 to any folder url to get download instructions for aria2 (example⁠)
  • To get a list of absolute urls for all nested files within a folder, just add ?raw to any folder url
  • Basic Auth support

⁠Setup

⁠Via docker cli

docker run -d \
  -e BASEPATH=/ `#optional` \
  -e BASIC_AUTH_ENABLED=false `#optional` \
  -e BASIC_AUTH_USER=admin `#optional` \
  -e BASIC_AUTH_PASSWORD=fileserver `#optional` \
  -v /path/to/files:/public \
  -p "80:80" \
  --restart unless-stopped \
  peterberweiler/fileserver

⁠Via docker compose

version: "3"
services:
  fileserver:
    image: peterberweiler/fileserver
    container_name: fileserver
    environment:
        # all of these are optional
      - BASEPATH=/
      - BASIC_AUTH_ENABLED=false 
      - BASIC_AUTH_REALM=admin 
      - BASIC_AUTH_USER=admin 
      - BASIC_AUTH_PASSWORD=fileserver 
    volumes:
      - /path/to/files:/public
    ports:
      - "80:80"
    restart: unless-stopped

⁠Environment Variables

VariableDefaultFunction
BASEPATH/if your file server is behind another reverse proxy you need to set this to the path where it is reachable (for example /myfiles)
BASIC_AUTH_ENABLEDfalseenables basic auth, for the indices and files (Reminder: when using http your username, password and traffic will not be encrypted)
BASIC_AUTH_USERadminbasic auth username
BASIC_AUTH_PASSWORDfileserverbasic auth password
BASIC_AUTH_REALMadminbasic auth realm, only needed if you have another basic auth server on the same url

⁠Url Parameters

ParameterFunction
?rawreturns a list of absolute urls for all files in the current directory and all children
?aria2returns download instructions for aria2c
?depth=5limits how many levels of sub folders should be included (can be combined with aria2 and raw)

⁠Url Examples

QueryFunction
/movies?aria2returns download instructions for the complete movies directory
/documents/text?raw&depth=1returns a list of absolute paths for all files in /documents/text and their direct children

⁠aria2 Usage

You can use it with aria2 like so:

curl http://localhost/media/?aria2 | aria2c -c -i -

This would download the complete media folder into the current directory. For more infos, check out the aria2 documentation⁠

⁠Server Response Examples

In these examples the following / folder is bound to /public

/ 
└─ media/
   ā”œā”€ movies/
   |  └─ cool-movie.mkv
   |
   └─ tv/
      └─ cool-series/
         ā”œā”€ s01e01.mp4
         └─ s01e02.mp4
⁠http://localhost/media?raw
http://localhost/media/movies/cool-movie.mkv
http://localhost/media/tv/cool-series/s01e01.mp4
http://localhost/media/tv/cool-series/s01e02.mp4
⁠http://localhost/media?raw&depth=1
http://localhost/media/movies/cool-movie.mkv
⁠http://localhost/media?aria2
http://localhost/media/movies/cool-movie.mkv
  dir=movies
  out=cool-movie.mkv
http://localhost/media/tv/cool-series/s01e01.mp4
  dir=tv/cool-series
  out=s01e01.mp4
http://localhost/media/tv/cool-series/s01e02.mp4
  dir=tv/cool-series
  out=s01e02.mp4

Tag summary

Content type

Image

Digest

Size

113.3 MB

Last updated

almost 5 years ago

docker pull peterberweiler/fileserver