Browse Source

fix: 解决停止一键部署网站失败的问题 (#930)

pull/933/head
zhengkunwang223 2 years ago committed by GitHub
parent
commit
ed3e7e7c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      backend/app/service/website_utils.go
  2. 17
      backend/utils/nginx/components/server.go

2
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(/|$)"})
}

17
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
}

Loading…
Cancel
Save