Browse Source

Allow config file includes per-site.

pull/4/head
Chris Smith 8 years ago
parent
commit
cd2a04e3cb
2 changed files with 18 additions and 0 deletions
  1. 16
    0
      README.md
  2. 2
    0
      nginx.tpl

+ 16
- 0
README.md View File

@@ -64,3 +64,19 @@ docker run -d \
64 64
   csmith/service-nginx:latest
65 65
 ```
66 66
 
67
+## Config files
68
+
69
+The container will write out the config to /nginx-config/vhosts.conf (which
70
+should put it at the root of the nginx-config volume if you're using the
71
+configuration described above).
72
+
73
+Each service has an include directive that allows site-specific config files to
74
+be placed in a directory. For example, if a container has a vhost label of
75
+`example.com,www.example.com`, you can create a file at `/example.com/foo.conf`
76
+in the nginx-data volume and it will be included within that site's `server`
77
+block.
78
+
79
+It's intended that `nginx-config` is mounted under `/etc/nginx/conf.d/` when
80
+running nginx so global configuration files can be placed alongside the
81
+`vhost.conf` file.
82
+

+ 2
- 0
nginx.tpl View File

@@ -7,6 +7,8 @@ server {
7 7
     ssl_certificate {{ service.certificate }};
8 8
     ssl_certificate_key {{ service.certificate_key }};
9 9
 
10
+    include {{ service.vhosts[0] }}/*.conf;
11
+
10 12
     location / {
11 13
         proxy_pass {{ service.protocol }}://{{ service.host }}:{{ service.port }};
12 14
     }

Loading…
Cancel
Save