gitnginxconfigurationdocker

remote control nginx configuration


I want to avoid connecting to remote machine to edit nginx conf files.
I'd rather control it from git and jenkins.

What's the best practice to manage my nginx configuration history in a way that I can easily test it, and role back?

Thanks!


Solution

  • You may create a volume with comfiguration and mount it to nginx container. When you need to update your configuration, just replace files in volume (git, copy files from host, etc) and send reload command to nginx service via docer exec. Also, you can mount (read only) host directory with nginx config to container.

    https://docs.docker.com/engine/userguide/containers/dockervolumes/