KyleAMathews / docker-nginx

Nginx Docker image for easy hosting of static sites
MIT License
336 stars 108 forks source link

How do i #6

Closed frob closed 8 years ago

frob commented 9 years ago

How do configure the expected host? For example, how would I set this to expect traffic from www.example.com?

arbourd commented 9 years ago

The default configuration, in default, binds localhost. To bind to example.com only, you'd have to change localhost to example.com.

To customize that configuration, you would have to override it in your app's/static site's Dockerfile.

More on NGINX's server blocks: https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/

frob commented 9 years ago

My question is less about setting up NGINX by editing the nginx conf, but instead about if there is any way to pass that as a parameter to docker. It would be nice if a simple container such as nginx didn't have to be customized to change only the host name.

arbourd commented 9 years ago

As far as I know, you need to edit the NGINX server block to do what you're asking. This container does not support that kind of manipulation, but I'm sure it's possible with an init script and env variables.

sp90 commented 8 years ago

You wrap this in your own project Dockerfile and base it off this image

then you just copy in your modified version that matches your settings

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

# Build docker file
# docker build -t CONTAINERNAME .

FROM kyma/docker-nginx

COPY myDefault /etc/nginx/sites-enabled/default

CMD 'nginx'
KyleAMathews commented 8 years ago

@sp90 if you're feeling up to another PR, that'd be great to add to the README :-)

sp90 commented 8 years ago

👍