Skip to content

Commit 6538282

Browse files
fix: 解决网站停止之后再启动运行目录错误的问题 (#1666)
Refs #1665
1 parent 87326e3 commit 6538282

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backend/app/service/website_utils.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ func opWebsite(website *model.Website, operate string) error {
536536
if files.NewFileOp().Stat(absoluteRewritePath) {
537537
server.UpdateDirective("include", []string{rewriteInclude})
538538
}
539+
rootIndex := path.Join("/www/sites", website.Alias, "index")
540+
if website.SiteDir != "/" {
541+
rootIndex = path.Join(rootIndex, website.SiteDir)
542+
}
539543
switch website.Type {
540544
case constant.Deployment:
541545
server.RemoveDirective("root", nil)
@@ -546,12 +550,11 @@ func opWebsite(website *model.Website, operate string) error {
546550
proxy := fmt.Sprintf("http://127.0.0.1:%d", appInstall.HttpPort)
547551
server.UpdateRootProxy([]string{proxy})
548552
case constant.Static:
549-
server.UpdateRoot(path.Join("/www/sites", website.Alias, "index"))
553+
server.UpdateRoot(rootIndex)
550554
server.UpdateRootLocation()
551555
case constant.Proxy:
552556
server.RemoveDirective("root", nil)
553557
case constant.Runtime:
554-
rootIndex := path.Join("/www/sites", website.Alias, "index")
555558
server.UpdateRoot(rootIndex)
556559
localPath := ""
557560
if website.ProxyType == constant.RuntimeProxyUnix {

0 commit comments

Comments
 (0)