Display a list of discovered virtual hosts
This commit is contained in:
parent
6d646d92f8
commit
ea86a04638
4 changed files with 24 additions and 1 deletions
1
Procfile
1
Procfile
|
@ -1,2 +1,3 @@
|
|||
nginx: nginx
|
||||
dockergen: docker-gen -watch -only-exposed -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
|
||||
dockergen: docker-gen -watch -only-exposed /app/index.html.tmpl /app/www/index.html
|
||||
|
|
13
index.html.tmpl
Normal file
13
index.html.tmpl
Normal file
|
@ -0,0 +1,13 @@
|
|||
<h1>Nginx Reverse Proxy for Docker</h1>
|
||||
|
||||
{{ with groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
||||
<ul>
|
||||
{{ range $host, $containers := . }}
|
||||
<li><a href="http://{{ $host }}">{{ (first $containers).Name }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ else }}
|
||||
<p>The Nginx Reverse Proxy for Docker is started but no virtual hosts have been found. Try starting one with the <em>VIRTUAL_HOST</em> environement variable set.</p>
|
||||
<pre>$ docker run --rm --name helloworld --expose 8080 -e VIRTUAL_HOST=helloworld.127.0.0.1.xip.io adejonge/helloworld</pre>
|
||||
<p><a href="https://github.com/jwilder/nginx-proxy#usage">More information on Github</a></p>
|
||||
{{ end }}
|
|
@ -34,7 +34,10 @@ proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
|
|||
server {
|
||||
listen 80 default_server;
|
||||
server_name _; # This is just an invalid value which will never trigger on a real hostname.
|
||||
return 503;
|
||||
location / {
|
||||
root /app/www/;
|
||||
}
|
||||
error_page 404 /;
|
||||
}
|
||||
|
||||
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
||||
|
|
6
www/index.html
Normal file
6
www/index.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<h1>Nginx Reverse Proxy for Docker</h1>
|
||||
|
||||
<p>
|
||||
The Nginx Reverse Proxy for Docker has not yet started.
|
||||
<a href="https://github.com/jwilder/nginx-proxy#usage">More information on Github</a>
|
||||
</p>
|
Loading…
Reference in a new issue