GitXplorerGitXplorer
K

docker-nginx

public
335 stars
108 forks
6 issues

Commits

List of commits on branch master.
Unverified
f3c4745f1a79c53e80e8b868eb075fb80b8b7216

Merge pull request #12 from sp90/master

KKyleAMathews committed 9 years ago
Unverified
658ad21b53b0513962a2445677658637426455c4

update readme to guide how to swap files

ssp90 committed 9 years ago
Unverified
a4ee2130e0e68e19d4cd077b47ba449346073fb2

Merge pull request #10 from sp90/master

KKyleAMathews committed 9 years ago
Unverified
bbf51e6025eab9f05a701bf24bb4c137a721fd5c

copy new files to docker container

ssp90 committed 9 years ago
Unverified
f72f771e26c36ce04e8da8c449a6bf8c0889ab16

add include basic.conf in our default setup

ssp90 committed 9 years ago
Unverified
d9753819b2858c69247f337e9e9e61895c183e33

add log files

ssp90 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'