https://github.com/realorangeone/docker-static-server
Customizable and performant static file server - powered by Nginx
https://github.com/realorangeone/docker-static-server
Last synced: 12 months ago
JSON representation
Customizable and performant static file server - powered by Nginx
- Host: GitHub
- URL: https://github.com/realorangeone/docker-static-server
- Owner: RealOrangeOne
- License: mit
- Created: 2020-05-08T22:49:43.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-06T00:48:18.000Z (over 1 year ago)
- Last Synced: 2025-02-10T12:43:08.680Z (over 1 year ago)
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/theorangeone/static-server
- Size: 43 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Static Server

Customizable and performant static file server - powered by Nginx.
__Note__: This container is designed for hosting static files, rather than for serving a static site. For that, check out [`docker-website-server`](https://github.com/RealOrangeOne/docker-website-server).
## _"Why not just use `nginx:alpine`?"_
If you're not really bothered, the default `nginx` container will work just fine for you, however this container has a few modifications which make it more suited to serving static files:
- Use environment variables for [customization](#customization)
- Healthcheck endpoint
- GZIP all files
- Use `X-Forwarded-For` header when getting client IP
Nginx makes a brilliant file server regardless of how you use it.
## Usage
```yml
version: "2.3"
services:
static:
image: theorangeone/static-server:latest
volumes:
- ".:/srv:ro"
ports:
- "80:80"
```
The server will serve files in the `/srv` directory. This directory can be mounted read-only.
## Customization
This image supports some customizations:
- `$INDEX` (`on` / `off`): Enable file listing, powered by [`autoindex`](https://nginx.org/en/docs/http/ngx_http_autoindex_module.html)
- `$FANCY_INDEX` (`on` / `off`): Enable file listing, powered by [`fancy_index`](https://www.nginx.com/resources/wiki/modules/fancy_index/)
- `$PUID`: Set the user nginx runs as (default `1000`)
If you'd rather add some additional configuration yourself, you can mount an additional nginx config at `/etc/nginx/extra.conf`, which will be included in the primary config.