From 541352b6d8871b540f23f553010613b67b861853 Mon Sep 17 00:00:00 2001 From: Dingjun Date: Fri, 6 Jan 2017 17:56:33 +0800 Subject: [PATCH] can set docroot per sub-path --- conf.go | 1 + routers.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/conf.go b/conf.go index e16a7f1..de10266 100644 --- a/conf.go +++ b/conf.go @@ -27,6 +27,7 @@ type vhost struct { type rule struct { URLPrefix string IsRegex bool + Docroot string Type string Target target } diff --git a/routers.go b/routers.go index 79686d3..73cec13 100644 --- a/routers.go +++ b/routers.go @@ -63,7 +63,11 @@ func initRouters(cfg conf) { case "uwsgi": registerUwsgiHandler(rule, router) case "fastcgi": - registerFastCGIHandler(rule, l.Docroot, router) + docroot := l.Docroot + if rule.Docroot != "" { + docroot = rule.Docroot + } + registerFastCGIHandler(rule, docroot, router) case "reverse": registerHTTPHandler(rule, router) default: