From 6538282a7b3d9ca7c32bc55752e60dc2e8ede1da Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:20:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E4=B9=8B=E5=90=8E=E5=86=8D=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=9B=AE=E5=BD=95=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#1666)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/1665 --- backend/app/service/website_utils.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/service/website_utils.go b/backend/app/service/website_utils.go index 18bb7bb96..220d6ccee 100644 --- a/backend/app/service/website_utils.go +++ b/backend/app/service/website_utils.go @@ -536,6 +536,10 @@ func opWebsite(website *model.Website, operate string) error { if files.NewFileOp().Stat(absoluteRewritePath) { server.UpdateDirective("include", []string{rewriteInclude}) } + rootIndex := path.Join("/www/sites", website.Alias, "index") + if website.SiteDir != "/" { + rootIndex = path.Join(rootIndex, website.SiteDir) + } switch website.Type { case constant.Deployment: server.RemoveDirective("root", nil) @@ -546,12 +550,11 @@ func opWebsite(website *model.Website, operate string) error { proxy := fmt.Sprintf("http://127.0.0.1:%d", appInstall.HttpPort) server.UpdateRootProxy([]string{proxy}) case constant.Static: - server.UpdateRoot(path.Join("/www/sites", website.Alias, "index")) + server.UpdateRoot(rootIndex) server.UpdateRootLocation() case constant.Proxy: server.RemoveDirective("root", nil) case constant.Runtime: - rootIndex := path.Join("/www/sites", website.Alias, "index") server.UpdateRoot(rootIndex) localPath := "" if website.ProxyType == constant.RuntimeProxyUnix {