diff --git a/bin/homepageConfig b/bin/homepageConfig --- a/bin/homepageConfig +++ b/bin/homepageConfig @@ -14,13 +14,7 @@ graph = showconfig.getGraph() netHome = graph.value(showconfig.showUri(), L9['networking']) print "listen %s;" % splitport(urlparse(graph.value(netHome, L9['webServer'])).netloc)[1] -for role, server in sorted(graph.predicate_objects(netHome)): - if not server.startswith('http') or role == L9['webServer']: - continue - path = graph.value(role, L9['urlPath']) - if not path: - continue - server = server.rstrip('/') +def location(path, server): print """ location /%(path)s { @@ -33,3 +27,21 @@ for role, server in sorted(graph.predica proxy_pass %(server)s; rewrite /[^/]+/(.*) /$1 break; }""" % vars() + +for role, server in sorted(graph.predicate_objects(netHome)): + if not server.startswith('http') or role == L9['webServer']: + continue + path = graph.value(role, L9['urlPath']) + if not path: + continue + server = server.rstrip('/') + location(path, server) + + + +showPath = showconfig.showUri().split('/', 3)[-1] +print """ + location /%(path)s { + root %(root)s; + }""" % {'path': showPath, + 'root': showconfig.root()[:-len(showPath)]}