mirror of https://github.com/1Panel-dev/1Panel
feat: PHP 配置增加 pathinfo 配置 (#3269)
Refs https://github.com/1Panel-dev/1Panel/issues/3254pull/3281/head
parent
e48c224c41
commit
94a2d4b475
|
@ -281,9 +281,38 @@ func (s *Server) UpdatePHPProxy(proxy []string, localPath string) {
|
||||||
Parameters: []string{"fastcgi_params"},
|
Parameters: []string{"fastcgi_params"},
|
||||||
})
|
})
|
||||||
if localPath == "" {
|
if localPath == "" {
|
||||||
|
block.Directives = append(block.Directives, &Directive{
|
||||||
|
Name: "set",
|
||||||
|
Parameters: []string{"$real_script_name", "$fastcgi_script_name"},
|
||||||
|
})
|
||||||
|
ifDir := &Directive{
|
||||||
|
Name: "if",
|
||||||
|
Parameters: []string{"($fastcgi_script_name ~ \"^(.+?\\.php)(/.+)$\")"},
|
||||||
|
}
|
||||||
|
ifDir.Block = &Block{
|
||||||
|
Directives: []IDirective{
|
||||||
|
&Directive{
|
||||||
|
Name: "set",
|
||||||
|
Parameters: []string{"$real_script_name", "$1"},
|
||||||
|
},
|
||||||
|
&Directive{
|
||||||
|
Name: "set",
|
||||||
|
Parameters: []string{"$path_info", "$2"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
block.Directives = append(block.Directives, ifDir)
|
||||||
block.Directives = append(block.Directives, &Directive{
|
block.Directives = append(block.Directives, &Directive{
|
||||||
Name: "fastcgi_param",
|
Name: "fastcgi_param",
|
||||||
Parameters: []string{"SCRIPT_FILENAME", "$document_root$fastcgi_script_name"},
|
Parameters: []string{"SCRIPT_FILENAME", "$document_root$real_script_name"},
|
||||||
|
})
|
||||||
|
block.Directives = append(block.Directives, &Directive{
|
||||||
|
Name: "fastcgi_param",
|
||||||
|
Parameters: []string{"SCRIPT_NAME", "$real_script_name"},
|
||||||
|
})
|
||||||
|
block.Directives = append(block.Directives, &Directive{
|
||||||
|
Name: "fastcgi_param",
|
||||||
|
Parameters: []string{"PATH_INFO", "$path_info"},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
block.Directives = append(block.Directives, &Directive{
|
block.Directives = append(block.Directives, &Directive{
|
||||||
|
|
Loading…
Reference in New Issue