瀏覽代碼

Allow config file includes per-site.

pull/4/head
Chris Smith 8 年之前
父節點
當前提交
cd2a04e3cb
共有 2 個檔案被更改,包括 18 行新增0 行删除
  1. 16
    0
      README.md
  2. 2
    0
      nginx.tpl

+ 16
- 0
README.md 查看文件

64
   csmith/service-nginx:latest
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 查看文件

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

Loading…
取消
儲存