docker run -v /srv/web:/static -p 8080:80 flashspys/nginx-static
This command exposes an nginx server on port 8080 which serves the folder /srv/web from the host.
The image is roughly half the size of the official nginx image and can only be used for static file serving.
To serve your static files over HTTPS you must use another reverse proxy. We recommend træfik as a lightweight reverse proxy with docker integration. Do not even try to get HTTPS working with this image only, as it does not contain the nginx ssl module.
version: '3'
services:
example.org:
image: flashspys/nginx-static
container_name: example.org
ports:
- 8080:80
volumes:
- /srv/web:/static
To use nginx-static with træfik add an entry to your services in a docker-compose.yaml.
example.org:
image: flashspys/nginx-static
container_name: example.org
networks:
- web
expose:
- 80
labels:
- traefik.backend=example.org
- traefik.docker.network=web
- traefik.frontend.rule=Host:example.org
- traefik.frontend.headers.STSSeconds=315360000
- traefik.frontend.headers.STSIncludeSubdomains=true
- traefik.frontend.headers.STSPreload=true
volumes:
- /srv/web:/static
Content type
Image
Digest
Size
4.9 MB
Last updated
over 7 years ago
docker pull msrd0/nginx