feat: 增加创建运行环境类型网站

This commit is contained in:
zhengkunwang223
2023-04-03 17:47:23 +08:00
committed by zhengkunwang223
parent d4c1caa26a
commit c629fa9575
28 changed files with 308 additions and 55 deletions

View File

@@ -237,6 +237,29 @@ func (s *Server) UpdateRootProxy(proxy []string) {
s.UpdateDirectiveBySecondKey("location", "/", newDir)
}
func (s *Server) UpdatePHPProxy(proxy []string) {
newDir := Directive{
Name: "location",
Parameters: []string{"~ [^/]\\.php(/|$)"},
Block: &Block{},
}
block := &Block{}
block.Directives = append(block.Directives, &Directive{
Name: "fastcgi_pass",
Parameters: proxy,
})
block.Directives = append(block.Directives, &Directive{
Name: "include",
Parameters: []string{"fastcgi-php.conf"},
})
block.Directives = append(block.Directives, &Directive{
Name: "include",
Parameters: []string{"fastcgi_params"},
})
newDir.Block = block
s.UpdateDirectiveBySecondKey("location", "~ [^/]\\.php(/|$)", newDir)
}
func (s *Server) UpdateDirectiveBySecondKey(name string, key string, directive Directive) {
directives := s.Directives
index := -1