This commit is contained in:
marema31 2016-02-13 22:26:11 +00:00
commit 23c7b9fd65
3 changed files with 56 additions and 3 deletions

View file

@ -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
gennginx: docker-gen -watch -only-exposed -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
genindex: docker-gen -watch -only-exposed /app/index.tmpl /usr/share/nginx/html/index.html

25
index.tmpl Normal file
View file

@ -0,0 +1,25 @@
{{ $title := or $.Env.TITLE "List of proxied sites" }}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{ $title }}</title>
</head>
<body>
<!--<div class='titre' style='width:1500px'><h1>Reseau Mare Mais</h1></div>-->
<h1>{{ $title }}</h1>
<div>
<ul>
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
{{ range $container := $containers }}
{{if $container.Env.TITLE}}
<li><a href='http://{{ $container.Env.VIRTUAL_HOST }}'>{{$container.Env.TITLE}}</a></li>
{{else}}
<li><a href='http://{{ $container.Env.VIRTUAL_HOST }}'>{{$container.Env.VIRTUAL_HOST}}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
</body>
</html>

View file

@ -55,19 +55,46 @@ server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 80;
access_log /var/log/nginx/access.log vhost;
return 503;
return 503;
}
{{ if $.Env.INDEX_HOST }}
server {
server_name {{$.Env.INDEX_HOST}}; # The local site
listen 80;
access_log /var/log/nginx/access.log vhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
{{ end }}
{{ if (and (exists "/etc/nginx/certs/default.crt") (exists "/etc/nginx/certs/default.key")) }}
server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 443 ssl http2;
access_log /var/log/nginx/access.log vhost;
return 503;
return 503;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
{{ if $.Env.INDEX_HOST }}
server {
server_name {{$.Env.INDEX_HOST}}; # The local site
listen 443 ssl http2;
access_log /var/log/nginx/access.log vhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
{{ end }}
{{ end }}
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}