GitXplorerGitXplorer
K

docker-nginx

public
335 stars
108 forks
6 issues

Commits

List of commits on branch master.
Unverified
2054105b9342c195a4e9b541658ef00ec4f3376e

Create LICENSE.txt

KKyleAMathews committed 8 years ago
Unverified
f926be9af6dffffbb0be137b892e04f81111b6bc

Merge pull request #16 from sp90/master

KKyleAMathews committed 8 years ago
Unverified
163d1d565b31c54ee60250d52a5ba7a5dcb01502

Update nginx version

ssp90 committed 8 years ago
Unverified
78f2a952e7a0b5b1e11312c32e423cc1575bce39

Merge pull request #14 from pierreozoux/master

KKyleAMathews committed 8 years ago
Unverified
f35b6446e03b9f7f5be429343d601ce5496e5d61

1 week expiration for static assets

ppierreozoux committed 8 years ago
Unverified
393ba227dc6008fabf5f98b25bd42accdd179e38

Update README

KKyleAMathews committed 9 years ago

README

The README file for this repository.

docker-nginx

A high-performance Nginx base image for Docker to serve static websites. It will serve anything in the /var/www directory.

To build a Docker image for your site, you'll need to create a Dockerfile. For example, if your site is in a directory called src/, you could create this Dockerfile:

FROM kyma/docker-nginx
COPY src/ /var/www
CMD 'nginx'

Then build and run it:

$ docker build -t mysite .
...
Successfully built 5ae2fb5cf4f8
$ docker run -p 80:80 -d mysite
da809981545f
$ curl localhost
...

Docker Hub

The trusted build information can be found on the Docker Hub at https://registry.hub.docker.com/u/kyma/docker-nginx/.

SSL

To use SSL, put your certs in /etc/nginx/ssl and enable the default-ssl site:

ADD server.crt /etc/nginx/ssl/
ADD server.key /etc/nginx/ssl/
RUN ln -s /etc/nginx/sites-available/default-ssl /etc/nginx/sites-enabled/default-ssl

When you run it, you'll want to make port 443 available, e.g.:

$ docker run -p 80:80 -p 443:443 -d mysite

nginx.conf

The nginx.conf and mime.types are pulled with slight modifications from the h5bp Nginx HTTP server boilerplate configs project at https://github.com/h5bp/server-configs-nginx

Customized configs

To modify the NGINX config, you would just create a custom Dockerfile like the following where you copy in your modified config files.

# Guide here:
# https://github.com/KyleAMathews/docker-nginx

# Build docker file
# docker build -t CONTAINERNAME .

# Build from this repo's image
FROM kyma/docker-nginx

# Example if you wanna swap the default server file.
COPY path/to/your/default /etc/nginx/sites-enabled/default

# Add src.
COPY src/ /var/www

CMD 'nginx'