Skip to content
This repository has been archived by the owner. It is now read-only.

Configuration folder & sites configuration as mountable volume #10

Closed
vovimayhem opened this issue Aug 26, 2014 · 7 comments
Closed

Configuration folder & sites configuration as mountable volume #10

vovimayhem opened this issue Aug 26, 2014 · 7 comments

Comments

@vovimayhem
Copy link

Hi! A couple of suggestions:

  • Configure Nginx build process to place the configuration files inside it's own directory (Currently it places all the files in the /etc folder, mixed up with other configuration files). Actually use the same location used by the .deb distribution.
  • Modify the nginx.conf file used by default so that it loads site conf files from the /etc/nginx/sites-enabled directory, in a similar fashion as the .deb distribution does.
  • Make the /etc/nginx/sites-enabled a mountable volume.
  • Install the nginx executables in the /usr/share directory instead of /usr/local

All this would help to:

  1. Easier for customization, since binary and config files are in the places people familiar with the *.deb packaged version expects them to be.
  2. Apart from specifying a custom nginx.conf via the mounted volumes option, people can also just mount a folder with virtual host sites configuration files.
@stuartpb
Copy link

I've been getting by in plushu/plushu-container by mounting my Nginx conf volume in /usr/local/nginx/etc and just explicitly specifying the location with -c.

If this is proposing setting the default prefix to /etc/nginx and the default config to /etc/nginx/nginx.conf, I'm all for that (it'd be one less thing to specify and one less difference I'd have to worry about between running my configuration in a container vs. on the host).

I don't know anything about the default nginx.conf or sites-enabled, I don't use either of those. (https://github.com/plushu/plushu-nginx-container/blob/master/install should give a fair idea of what Plushu's Nginx setup looks like)

@yosifkit
Copy link
Member

I like moving the conf files to their own folder in /etc. We should incorporate this idea into the other base images so that configuration is easier to override, esp given moby/moby#6011.

@AsavarTzeth
Copy link

I second this. In fact I tried to get it in a pull request way back but then it was of no interest for some reason.

Happy to see it coming anyways.

@felixhummel
Copy link

Here's what I use: felixhummel@a06716a

Interesting bits

--conf-path=/etc/nginx/nginx.conf
--prefix=/nginx

And the run looks like this:

docker run \
    -v /some/data/dir:/nginx \
    -v /config/dir/etc:/etc/nginx \
    nginx:latest

Not perfect, but works for me. I guess we need some best practices / standards guide for those kind of things. /nginx seems like a hack to me, but I wanted it separate from the config.

@stuartpb
Copy link

Assuming /nginx contains your site pages etc, maybe use /var/www or /var/www/html?

@felixhummel
Copy link

  1. conf-path and prefix should be separate, because
    • include foo.conf then refers to $(dirname $conf-path)/foo.conf for configs and
    • root bar refers to $prefix/bar for static data
  2. conf-path should be /etc/nginx/nginx.conf to allow mounting of /etc/nginx or putting those configs in the container
  3. prefix should then be /var/www (Debian-style), which could be mounted completely or split up into /var/www/site_a and /var/www/site_b

See also http://nginx.org/en/docs/configure.html

@yosifkit
Copy link
Member

So, the new images will have /etc/nginx/ volume and should be up on the hub in the next 4-5 hours.

Nginx upstream will now be providing and maintaining the images nginxinc/docker-nginx.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants