Closed frob closed 8 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/
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.
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.
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'
@sp90 if you're feeling up to another PR, that'd be great to add to the README :-)
👍
How do configure the expected host? For example, how would I set this to expect traffic from www.example.com?