From ed3e7e7c26d0824648dfdb58b996d8a488269593 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 8 May 2023 15:39:41 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E9=83=A8=E7=BD=B2=E7=BD=91=E7=AB=99=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=20(#930)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/website_utils.go | 2 +- backend/utils/nginx/components/server.go | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/backend/app/service/website_utils.go b/backend/app/service/website_utils.go index c0aa74859..23a2889ca 100644 --- a/backend/app/service/website_utils.go +++ b/backend/app/service/website_utils.go @@ -504,7 +504,7 @@ func opWebsite(website *model.Website, operate string) error { switch website.Type { case constant.Deployment: - server.RemoveDirective("location", []string{"", "/"}) + server.RemoveDirective("location", []string{"/"}) case constant.Runtime: server.RemoveDirective("location", []string{"~", "[^/]\\.php(/|$)"}) } diff --git a/backend/utils/nginx/components/server.go b/backend/utils/nginx/components/server.go index 9b162627e..e9d62db60 100644 --- a/backend/utils/nginx/components/server.go +++ b/backend/utils/nginx/components/server.go @@ -5,9 +5,8 @@ import ( ) type Server struct { - Comment string - Listens []*ServerListen - //Locations []*Location + Comment string + Listens []*ServerListen Directives []IDirective Line int } @@ -22,15 +21,6 @@ func NewServer(directive IDirective) (*Server, error) { switch dir.GetName() { case "listen": server.Listens = append(server.Listens, NewServerListen(dir.GetParameters(), dir.GetLine())) - //case "location": - // locationDirective := &Directive{ - // Name: "location", - // Parameters: dir.GetParameters(), - // Block: dir.GetBlock(), - // Line: dir.GetLine(), - // Comment: dir.GetComment(), - // } - // server.Locations = append(server.Locations, NewLocation(locationDirective)) default: server.Directives = append(server.Directives, dir) } @@ -61,9 +51,6 @@ func (s *Server) GetDirectives() []IDirective { for _, ls := range s.Listens { directives = append(directives, ls) } - //for _, la := range s.Locations { - // directives = append(directives, la) - //} directives = append(directives, s.Directives...) return directives }