mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 23:30:26 +08:00
服务支持fastcgi;路径规则支持匹配后缀
This commit is contained in:
@@ -220,6 +220,10 @@ func (this *RPCClient) HTTPAccessLogRPC() pb.HTTPAccessLogServiceClient {
|
|||||||
return pb.NewHTTPAccessLogServiceClient(this.pickConn())
|
return pb.NewHTTPAccessLogServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RPCClient) HTTPFastcgiRPC() pb.HTTPFastcgiServiceClient {
|
||||||
|
return pb.NewHTTPFastcgiServiceClient(this.pickConn())
|
||||||
|
}
|
||||||
|
|
||||||
func (this *RPCClient) SSLCertRPC() pb.SSLCertServiceClient {
|
func (this *RPCClient) SSLCertRPC() pb.SSLCertServiceClient {
|
||||||
return pb.NewSSLCertServiceClient(this.pickConn())
|
return pb.NewSSLCertServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package fastcgi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunGet(params struct{}) {
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CreatePopupAction) RunPost(params struct {
|
||||||
|
Address string
|
||||||
|
ParamsJSON []byte
|
||||||
|
ReadTimeout int64
|
||||||
|
PoolSize int32
|
||||||
|
PathInfoPattern string
|
||||||
|
IsOn bool
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
var fastcgiId = int64(0)
|
||||||
|
defer func() {
|
||||||
|
if fastcgiId > 0 {
|
||||||
|
this.CreateLogInfo("创建Fastcgi %d", fastcgiId)
|
||||||
|
} else {
|
||||||
|
this.CreateLogInfo("创建Fastcgi")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
params.Must.
|
||||||
|
Field("address", params.Address).
|
||||||
|
Require("请输入Fastcgi地址")
|
||||||
|
|
||||||
|
_, _, err := net.SplitHostPort(params.Address)
|
||||||
|
if err != nil {
|
||||||
|
this.FailField("address", "请输入正确的Fastcgi地址")
|
||||||
|
}
|
||||||
|
|
||||||
|
readTimeoutJSON, err := json.Marshal(&shared.TimeDuration{
|
||||||
|
Count: params.ReadTimeout,
|
||||||
|
Unit: "second",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
createResp, err := this.RPC().HTTPFastcgiRPC().CreateHTTPFastcgi(this.AdminContext(), &pb.CreateHTTPFastcgiRequest{
|
||||||
|
IsOn: params.IsOn,
|
||||||
|
Address: params.Address,
|
||||||
|
ParamsJSON: params.ParamsJSON,
|
||||||
|
ReadTimeoutJSON: readTimeoutJSON,
|
||||||
|
ConnTimeoutJSON: nil, // TODO 将来支持
|
||||||
|
PoolSize: params.PoolSize,
|
||||||
|
PathInfoPattern: params.PathInfoPattern,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fastcgiId = createResp.HttpFastcgiId
|
||||||
|
|
||||||
|
configResp, err := this.RPC().HTTPFastcgiRPC().FindEnabledHTTPFastcgiConfig(this.AdminContext(), &pb.FindEnabledHTTPFastcgiConfigRequest{HttpFastcgiId: fastcgiId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
configJSON := configResp.HttpFastcgiJSON
|
||||||
|
config := &serverconfigs.HTTPFastcgiConfig{}
|
||||||
|
err = json.Unmarshal(configJSON, config)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["fastcgi"] = config
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package fastcgi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IndexAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) Init() {
|
||||||
|
this.Nav("", "setting", "index")
|
||||||
|
this.SecondMenu("fastcgi")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) RunGet(params struct {
|
||||||
|
ServerId int64
|
||||||
|
}) {
|
||||||
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["webId"] = webConfig.Id
|
||||||
|
this.Data["fastcgiRef"] = webConfig.FastcgiRef
|
||||||
|
this.Data["fastcgiConfigs"] = webConfig.FastcgiList
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) RunPost(params struct {
|
||||||
|
WebId int64
|
||||||
|
FastcgiRefJSON []byte
|
||||||
|
FastcgiJSON []byte
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
}) {
|
||||||
|
defer this.CreateLogInfo("修改Web %d 的Fastcgi设置", params.WebId)
|
||||||
|
|
||||||
|
// TODO 检查配置
|
||||||
|
|
||||||
|
fastcgiRef := &serverconfigs.HTTPFastcgiRef{}
|
||||||
|
err := json.Unmarshal(params.FastcgiRefJSON, fastcgiRef)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fastcgiRefJSON, err := json.Marshal(fastcgiRef)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebFastcgi(this.AdminContext(), &pb.UpdateHTTPWebFastcgiRequest{
|
||||||
|
WebId: params.WebId,
|
||||||
|
FastcgiJSON: fastcgiRefJSON,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package fastcgi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||||
|
"github.com/iwind/TeaGo"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||||
|
server.
|
||||||
|
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeServer)).
|
||||||
|
Helper(serverutils.NewServerHelper()).
|
||||||
|
Prefix("/servers/server/settings/fastcgi").
|
||||||
|
GetPost("", new(IndexAction)).
|
||||||
|
GetPost("/createPopup", new(CreatePopupAction)).
|
||||||
|
GetPost("/updatePopup", new(UpdatePopupAction)).
|
||||||
|
EndAll()
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package fastcgi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdatePopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) RunGet(params struct {
|
||||||
|
FastcgiId int64
|
||||||
|
}) {
|
||||||
|
configResp, err := this.RPC().HTTPFastcgiRPC().FindEnabledHTTPFastcgiConfig(this.AdminContext(), &pb.FindEnabledHTTPFastcgiConfigRequest{HttpFastcgiId: params.FastcgiId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
configJSON := configResp.HttpFastcgiJSON
|
||||||
|
config := &serverconfigs.HTTPFastcgiConfig{}
|
||||||
|
err = json.Unmarshal(configJSON, config)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.Data["fastcgi"] = config
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UpdatePopupAction) RunPost(params struct {
|
||||||
|
FastcgiId int64
|
||||||
|
Address string
|
||||||
|
ParamsJSON []byte
|
||||||
|
ReadTimeout int64
|
||||||
|
PoolSize int32
|
||||||
|
PathInfoPattern string
|
||||||
|
IsOn bool
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
defer this.CreateLogInfo("修改Fastcgi %d", params.FastcgiId)
|
||||||
|
|
||||||
|
params.Must.
|
||||||
|
Field("address", params.Address).
|
||||||
|
Require("请输入Fastcgi地址")
|
||||||
|
|
||||||
|
_, _, err := net.SplitHostPort(params.Address)
|
||||||
|
if err != nil {
|
||||||
|
this.FailField("address", "请输入正确的Fastcgi地址")
|
||||||
|
}
|
||||||
|
|
||||||
|
readTimeoutJSON, err := json.Marshal(&shared.TimeDuration{
|
||||||
|
Count: params.ReadTimeout,
|
||||||
|
Unit: "second",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = this.RPC().HTTPFastcgiRPC().UpdateHTTPFastcgi(this.AdminContext(), &pb.UpdateHTTPFastcgiRequest{
|
||||||
|
HttpFastcgiId: params.FastcgiId,
|
||||||
|
IsOn: params.IsOn,
|
||||||
|
Address: params.Address,
|
||||||
|
ParamsJSON: params.ParamsJSON,
|
||||||
|
ReadTimeoutJSON: readTimeoutJSON,
|
||||||
|
ConnTimeoutJSON: nil, // TODO 将来支持
|
||||||
|
PoolSize: params.PoolSize,
|
||||||
|
PathInfoPattern: params.PathInfoPattern,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
configResp, err := this.RPC().HTTPFastcgiRPC().FindEnabledHTTPFastcgiConfig(this.AdminContext(), &pb.FindEnabledHTTPFastcgiConfigRequest{HttpFastcgiId: params.FastcgiId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
configJSON := configResp.HttpFastcgiJSON
|
||||||
|
config := &serverconfigs.HTTPFastcgiConfig{}
|
||||||
|
err = json.Unmarshal(configJSON, config)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["fastcgi"] = config
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -40,12 +40,12 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
IsOn: true,
|
IsOn: true,
|
||||||
}
|
}
|
||||||
if gzipId > 0 {
|
if gzipId > 0 {
|
||||||
resp, err := this.RPC().HTTPGzipRPC().FindEnabledHTTPGzipConfig(this.AdminContext(), &pb.FindEnabledGzipConfigRequest{GzipId: gzipId})
|
resp, err := this.RPC().HTTPGzipRPC().FindEnabledHTTPGzipConfig(this.AdminContext(), &pb.FindEnabledGzipConfigRequest{HttpGzipId: gzipId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(resp.GzipJSON, gzipConfig)
|
err = json.Unmarshal(resp.HttpGzipJSON, gzipConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
@@ -111,7 +111,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
|
|
||||||
if params.GzipId > 0 {
|
if params.GzipId > 0 {
|
||||||
_, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{
|
_, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{
|
||||||
GzipId: params.GzipId,
|
HttpGzipId: params.GzipId,
|
||||||
Level: types.Int32(params.Level),
|
Level: types.Int32(params.Level),
|
||||||
MinLength: minLength,
|
MinLength: minLength,
|
||||||
MaxLength: maxLength,
|
MaxLength: maxLength,
|
||||||
@@ -132,7 +132,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gzipRef.GzipId = resp.GzipId
|
gzipRef.GzipId = resp.HttpGzipId
|
||||||
}
|
}
|
||||||
|
|
||||||
gzipRefJSON, err := json.Marshal(gzipRef)
|
gzipRefJSON, err := json.Marshal(gzipRef)
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package fastcgi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IndexAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) Init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) RunGet(params struct {
|
||||||
|
LocationId int64
|
||||||
|
}) {
|
||||||
|
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithLocationId(this.AdminContext(), params.LocationId)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["webId"] = webConfig.Id
|
||||||
|
this.Data["fastcgiRef"] = webConfig.FastcgiRef
|
||||||
|
this.Data["fastcgiConfigs"] = webConfig.FastcgiList
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) RunPost(params struct {
|
||||||
|
WebId int64
|
||||||
|
FastcgiRefJSON []byte
|
||||||
|
FastcgiJSON []byte
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
}) {
|
||||||
|
defer this.CreateLogInfo("修改Web %d 的Fastcgi设置", params.WebId)
|
||||||
|
|
||||||
|
// TODO 检查配置
|
||||||
|
|
||||||
|
fastcgiRef := &serverconfigs.HTTPFastcgiRef{}
|
||||||
|
err := json.Unmarshal(params.FastcgiRefJSON, fastcgiRef)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fastcgiRefJSON, err := json.Marshal(fastcgiRef)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebFastcgi(this.AdminContext(), &pb.UpdateHTTPWebFastcgiRequest{
|
||||||
|
WebId: params.WebId,
|
||||||
|
FastcgiJSON: fastcgiRefJSON,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package fastcgi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/locationutils"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||||
|
"github.com/iwind/TeaGo"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||||
|
server.
|
||||||
|
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeServer)).
|
||||||
|
Helper(locationutils.NewLocationHelper()).
|
||||||
|
Helper(serverutils.NewServerHelper()).
|
||||||
|
Data("tinyMenuItem", "fastcgi").
|
||||||
|
Prefix("/servers/server/settings/locations/fastcgi").
|
||||||
|
GetPost("", new(IndexAction)).
|
||||||
|
EndAll()
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -39,12 +39,12 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
IsOn: true,
|
IsOn: true,
|
||||||
}
|
}
|
||||||
if gzipId > 0 {
|
if gzipId > 0 {
|
||||||
resp, err := this.RPC().HTTPGzipRPC().FindEnabledHTTPGzipConfig(this.AdminContext(), &pb.FindEnabledGzipConfigRequest{GzipId: gzipId})
|
resp, err := this.RPC().HTTPGzipRPC().FindEnabledHTTPGzipConfig(this.AdminContext(), &pb.FindEnabledGzipConfigRequest{HttpGzipId: gzipId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(resp.GzipJSON, gzipConfig)
|
err = json.Unmarshal(resp.HttpGzipJSON, gzipConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
@@ -109,7 +109,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
|
|
||||||
if params.GzipId > 0 {
|
if params.GzipId > 0 {
|
||||||
_, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{
|
_, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{
|
||||||
GzipId: params.GzipId,
|
HttpGzipId: params.GzipId,
|
||||||
Level: types.Int32(params.Level),
|
Level: types.Int32(params.Level),
|
||||||
MinLength: minLength,
|
MinLength: minLength,
|
||||||
MaxLength: maxLength,
|
MaxLength: maxLength,
|
||||||
@@ -128,7 +128,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gzipId := resp.GzipId
|
gzipId := resp.HttpGzipId
|
||||||
gzipRef.GzipId = gzipId
|
gzipRef.GzipId = gzipId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package locations
|
package locations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IndexAction struct {
|
type IndexAction struct {
|
||||||
@@ -24,11 +28,36 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["webId"] = webConfig.Id
|
this.Data["webId"] = webConfig.Id
|
||||||
|
|
||||||
|
locationMaps := []maps.Map{}
|
||||||
if webConfig.Locations != nil {
|
if webConfig.Locations != nil {
|
||||||
this.Data["locations"] = webConfig.Locations
|
for _, location := range webConfig.Locations {
|
||||||
} else {
|
err := location.ExtractPattern()
|
||||||
this.Data["locations"] = []interface{}{}
|
if err != nil {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
jsonData, err := json.Marshal(location)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m := maps.Map{}
|
||||||
|
err = json.Unmarshal(jsonData, &m)
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pieces := strings.Split(location.Pattern, " ")
|
||||||
|
if len(pieces) == 2 {
|
||||||
|
m["pattern"] = pieces[1]
|
||||||
|
m["patternTypeName"] = serverconfigs.FindLocationPatternTypeName(location.PatternType())
|
||||||
|
} else {
|
||||||
|
m["pattern"] = location.Pattern
|
||||||
|
m["patternTypeName"] = serverconfigs.FindLocationPatternTypeName(serverconfigs.HTTPLocationPatternTypePrefix)
|
||||||
|
}
|
||||||
|
locationMaps = append(locationMaps, m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Data["locations"] = locationMaps
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,6 +149,12 @@ func (this *LocationHelper) createMenus(serverIdString string, locationIdString
|
|||||||
"isActive": secondMenuItem == "websocket",
|
"isActive": secondMenuItem == "websocket",
|
||||||
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.WebsocketRef != nil && locationConfig.Web.WebsocketRef.IsPrior,
|
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.WebsocketRef != nil && locationConfig.Web.WebsocketRef.IsPrior,
|
||||||
})
|
})
|
||||||
|
menuItems = append(menuItems, maps.Map{
|
||||||
|
"name": "Fastcgi",
|
||||||
|
"url": "/servers/server/settings/locations/fastcgi?serverId=" + serverIdString + "&locationId=" + locationIdString,
|
||||||
|
"isActive": secondMenuItem == "fastcgi",
|
||||||
|
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.FastcgiRef != nil && locationConfig.Web.FastcgiRef.IsPrior,
|
||||||
|
})
|
||||||
|
|
||||||
return menuItems
|
return menuItems
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,6 +311,12 @@ func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdStri
|
|||||||
"isActive": secondMenuItem == "websocket",
|
"isActive": secondMenuItem == "websocket",
|
||||||
"isOn": serverConfig.Web != nil && serverConfig.Web.WebsocketRef != nil && serverConfig.Web.WebsocketRef.IsOn,
|
"isOn": serverConfig.Web != nil && serverConfig.Web.WebsocketRef != nil && serverConfig.Web.WebsocketRef.IsOn,
|
||||||
})
|
})
|
||||||
|
menuItems = append(menuItems, maps.Map{
|
||||||
|
"name": "Fastcgi",
|
||||||
|
"url": "/servers/server/settings/fastcgi?serverId=" + serverIdString,
|
||||||
|
"isActive": secondMenuItem == "fastcgi",
|
||||||
|
"isOn": serverConfig.Web != nil && serverConfig.Web.FastcgiRef != nil && serverConfig.Web.FastcgiRef.IsOn,
|
||||||
|
})
|
||||||
} else if serverConfig.IsTCPFamily() {
|
} else if serverConfig.IsTCPFamily() {
|
||||||
menuItems = append(menuItems, maps.Map{
|
menuItems = append(menuItems, maps.Map{
|
||||||
"name": "TCP",
|
"name": "TCP",
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import (
|
|||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/charset"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/charset"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/conds"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/conds"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/dns"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/dns"
|
||||||
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/fastcgi"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/gzip"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/gzip"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/headers"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/headers"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/http"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/http"
|
||||||
@@ -57,6 +58,7 @@ import (
|
|||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/accessLog"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/accessLog"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/cache"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/cache"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/charset"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/charset"
|
||||||
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/fastcgi"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/gzip"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/gzip"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/headers"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/headers"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/http"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/http"
|
||||||
|
|||||||
90
web/public/js/components/server/http-fastcgi-box.js
Normal file
90
web/public/js/components/server/http-fastcgi-box.js
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
Vue.component("http-fastcgi-box", {
|
||||||
|
props: ["v-fastcgi-ref", "v-fastcgi-configs", "v-is-location"],
|
||||||
|
data: function () {
|
||||||
|
let fastcgiRef = this.vFastcgiRef
|
||||||
|
if (fastcgiRef == null) {
|
||||||
|
fastcgiRef = {
|
||||||
|
isPrior: false,
|
||||||
|
isOn: false,
|
||||||
|
fastcgiIds: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let fastcgiConfigs = this.vFastcgiConfigs
|
||||||
|
if (fastcgiConfigs == null) {
|
||||||
|
fastcgiConfigs = []
|
||||||
|
} else {
|
||||||
|
fastcgiRef.fastcgiIds = fastcgiConfigs.map(function (v) {
|
||||||
|
return v.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
fastcgiRef: fastcgiRef,
|
||||||
|
fastcgiConfigs: fastcgiConfigs,
|
||||||
|
advancedVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isOn: function () {
|
||||||
|
return (!this.vIsLocation || this.fastcgiRef.isPrior) && this.fastcgiRef.isOn
|
||||||
|
},
|
||||||
|
createFastcgi: function () {
|
||||||
|
let that = this
|
||||||
|
teaweb.popup("/servers/server/settings/fastcgi/createPopup", {
|
||||||
|
height: "26em",
|
||||||
|
callback: function (resp) {
|
||||||
|
teaweb.success("添加成功", function () {
|
||||||
|
that.fastcgiConfigs.push(resp.data.fastcgi)
|
||||||
|
that.fastcgiRef.fastcgiIds.push(resp.data.fastcgi.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateFastcgi: function (fastcgiId, index) {
|
||||||
|
let that = this
|
||||||
|
teaweb.popup("/servers/server/settings/fastcgi/updatePopup?fastcgiId=" + fastcgiId, {
|
||||||
|
callback: function (resp) {
|
||||||
|
teaweb.success("修改成功", function () {
|
||||||
|
Vue.set(that.fastcgiConfigs, index, resp.data.fastcgi)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removeFastcgi: function (index) {
|
||||||
|
this.fastcgiRef.fastcgiIds.$remove(index)
|
||||||
|
this.fastcgiConfigs.$remove(index)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
template: `<div>
|
||||||
|
<input type="hidden" name="fastcgiRefJSON" :value="JSON.stringify(fastcgiRef)"/>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<prior-checkbox :v-config="fastcgiRef" v-if="vIsLocation"></prior-checkbox>
|
||||||
|
<tbody v-show="(!this.vIsLocation || this.fastcgiRef.isPrior)">
|
||||||
|
<tr>
|
||||||
|
<td class="title">是否启用配置</td>
|
||||||
|
<td>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input type="checkbox" v-model="fastcgiRef.isOn"/>
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tbody v-if="isOn()">
|
||||||
|
<tr>
|
||||||
|
<td>Fastcgi服务</td>
|
||||||
|
<td>
|
||||||
|
<div v-show="fastcgiConfigs.length > 0" style="margin-bottom: 0.5em">
|
||||||
|
<div class="ui label basic small" :class="{disabled: !fastcgi.isOn}" v-for="(fastcgi, index) in fastcgiConfigs">
|
||||||
|
{{fastcgi.address}} <a href="" title="修改" @click.prevent="updateFastcgi(fastcgi.id, index)"><i class="ui icon pencil small"></i></a> <a href="" title="删除" @click.prevent="removeFastcgi(index)"><i class="ui icon remove"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="ui divided"></div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="ui button tiny" @click.prevent="createFastcgi()">+</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="margin"></div>
|
||||||
|
</div>`
|
||||||
|
})
|
||||||
@@ -138,7 +138,7 @@ Vue.component("http-header-policy-box", {
|
|||||||
<div v-if="(!vIsLocation || requestHeaderRef.isPrior) && type == 'request'">
|
<div v-if="(!vIsLocation || requestHeaderRef.isPrior) && type == 'request'">
|
||||||
<h3>设置请求Header <a href="" @click.prevent="addSettingHeader(vRequestHeaderPolicy.id)">[添加新Header]</a></h3>
|
<h3>设置请求Header <a href="" @click.prevent="addSettingHeader(vRequestHeaderPolicy.id)">[添加新Header]</a></h3>
|
||||||
<p class="comment" v-if="requestSettingHeaders.length == 0">暂时还没有Header。</p>
|
<p class="comment" v-if="requestSettingHeaders.length == 0">暂时还没有Header。</p>
|
||||||
<table class="ui table selectable" v-if="requestSettingHeaders.length > 0">
|
<table class="ui table selectable celled" v-if="requestSettingHeaders.length > 0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>名称</th>
|
<th>名称</th>
|
||||||
@@ -179,8 +179,9 @@ Vue.component("http-header-policy-box", {
|
|||||||
|
|
||||||
<div v-if="type == 'response'">
|
<div v-if="type == 'response'">
|
||||||
<h3>设置响应Header <a href="" @click.prevent="addSettingHeader(vResponseHeaderPolicy.id)">[添加新Header]</a></h3>
|
<h3>设置响应Header <a href="" @click.prevent="addSettingHeader(vResponseHeaderPolicy.id)">[添加新Header]</a></h3>
|
||||||
|
<p class="comment" style="margin-top: 0; padding-top: 0">将会覆盖已有的同名Header。</p>
|
||||||
<p class="comment" v-if="responseSettingHeaders.length == 0">暂时还没有Header。</p>
|
<p class="comment" v-if="responseSettingHeaders.length == 0">暂时还没有Header。</p>
|
||||||
<table class="ui table selectable" v-if="responseSettingHeaders.length > 0">
|
<table class="ui table selectable celled" v-if="responseSettingHeaders.length > 0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>名称</th>
|
<th>名称</th>
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>网络协议</td>
|
<td>网络协议</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="ui dropdown auto-width" name="protocol">
|
<select class="ui dropdown auto-width" name="protocol" v-model="protocol">
|
||||||
<option v-for="protocol in protocols" :value="protocol.code">{{protocol.name}}</option>
|
<option v-for="p in protocols" :value="p.code">{{p.name}}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -16,7 +16,10 @@
|
|||||||
<td class="title">端口 *</td>
|
<td class="title">端口 *</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="address" ref="focus" v-model="address"/>
|
<input type="text" name="address" ref="focus" v-model="address"/>
|
||||||
<p class="comment">可以是一个数字端口(通常不超过65535),也可以是"地址:端口"的方式。</p>
|
<p class="comment">可以是一个数字端口(通常不超过65535),也可以是"地址:端口"的方式。
|
||||||
|
<span v-if="protocol == 'http'">HTTP常用端口为80。</span>
|
||||||
|
<span v-if="protocol == 'https'">HTTPS常用端口为443。</span>
|
||||||
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<tr v-if="accessLog.errors != null && accessLog.errors.length > 0">
|
<tr v-if="accessLog.errors != null && accessLog.errors.length > 0">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div v-for="error in accessLog.errors">
|
<div v-for="error in accessLog.errors">
|
||||||
<span class="red">{{error}}</span>
|
<pre><span class="red">{{error}}</span></pre>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>添加Fastcgi服务</h3>
|
||||||
|
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
|
||||||
|
<input type="hidden" name="paramsJSON" :value="JSON.stringify(params)"/>
|
||||||
|
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">Fastcgi地址</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="address" placeholder="比如 127.0.0.1:9000" maxlength="100" style="width:14em" ref="focus"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>自定义参数集</td>
|
||||||
|
<td>
|
||||||
|
<div v-for="(param, index) in params">
|
||||||
|
<div class="ui field" style="margin:0" v-if="param.nameZh.length > 0"><label>{{param.nameZh}}:</label></div>
|
||||||
|
<div class="ui fields inline" >
|
||||||
|
<div class="ui field">
|
||||||
|
<input type="text" name="paramNames" placeholder="参数名" v-model="param.name" style="width:12em" />
|
||||||
|
</div>
|
||||||
|
<div class="ui field">
|
||||||
|
<input type="text" name="paramValues" placeholder="参数值" v-model="param.value" style="width:16em"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui field" style="padding:0">
|
||||||
|
<a href="" title="删除" @click.prevent="removeParam(index)"><i class="ui icon remove"></i> </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="comment" v-if="params.length > 0">可以在参数值中使用一些变量<a href="http://teaos.cn/doc/proxy/Fastcgi.md#%E5%8F%82%E6%95%B0%E5%8F%98%E9%87%8F" target="_blank">点这里查看</a> 。</p>
|
||||||
|
|
||||||
|
<button class="ui button tiny" type="button" @click.prevent="addParam()">+</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<more-options-indicator></more-options-indicator>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tbody v-show="moreOptionsVisible">
|
||||||
|
<tr>
|
||||||
|
<td>读取超时时间</td>
|
||||||
|
<td>
|
||||||
|
<div class="ui right labeled input" style="width:7em">
|
||||||
|
<input type="number" name="readTimeout" maxlength="10" placeholder="比如 30"/>
|
||||||
|
<span class="ui basic label">秒</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>连接池尺寸</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="poolSize" value="0" maxlength="4" style="width:7em"/>
|
||||||
|
<p class="comment">0表示不限制,通常可以设置为CPU数量的两倍</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>PATH_INFO匹配</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="pathInfoPattern" maxlength="100"/>
|
||||||
|
<p class="comment">匹配PATH_INFO的正则表达式,用括号表示匹配的内容,如果只有一个匹配括号表示第一个括号为${fastcgi.pathInfo}值;如果有两个或两个以上的匹配括号,则第一个表示匹配的是${fastcgi.filename},第二个匹配的是${fastcgi.pathInfo},比如(\w+\.php)(.+)$。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>是否启用</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="isOn" value="1" checked="checked"></checkbox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.params = [
|
||||||
|
{
|
||||||
|
"name": "DOCUMENT_ROOT",
|
||||||
|
"value": "",
|
||||||
|
"nameZh": "文档目录"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SCRIPT_FILENAME",
|
||||||
|
"value": "",
|
||||||
|
"nameZh": "脚本文件"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
this.addParam = function () {
|
||||||
|
this.params.push({
|
||||||
|
"name": "",
|
||||||
|
"value": "",
|
||||||
|
"nameZh": ""
|
||||||
|
})
|
||||||
|
this.$delay(function () {
|
||||||
|
this.$find("form input[name='paramNames']").last().focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.removeParam = function (index) {
|
||||||
|
this.params.$remove(index)
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{$layout}
|
||||||
|
|
||||||
|
{$template "/left_menu"}
|
||||||
|
|
||||||
|
<div class="right-box">
|
||||||
|
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<input type="hidden" name="webId" :value="webId"/>
|
||||||
|
<http-fastcgi-box :v-fastcgi-ref="fastcgiRef" :v-fastcgi-configs="fastcgiConfigs"></http-fastcgi-box>
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.success = NotifyReloadSuccess("保存成功")
|
||||||
|
})
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>修改Fastcgi服务</h3>
|
||||||
|
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
|
||||||
|
<input type="hidden" name="fastcgiId" :value="fastcgi.id"/>
|
||||||
|
<input type="hidden" name="paramsJSON" :value="JSON.stringify(params)"/>
|
||||||
|
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">Fastcgi地址</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="address" placeholder="比如 127.0.0.1:9000" maxlength="100" style="width:14em" ref="focus" v-model="fastcgi.address"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>自定义参数集</td>
|
||||||
|
<td>
|
||||||
|
<div v-for="(param, index) in params">
|
||||||
|
<div class="ui field" style="margin:0" v-if="param.nameZh != null && param.nameZh.length > 0"><label>{{param.nameZh}}:</label></div>
|
||||||
|
<div class="ui fields inline" >
|
||||||
|
<div class="ui field">
|
||||||
|
<input type="text" name="paramNames" placeholder="参数名" v-model="param.name" style="width:12em" />
|
||||||
|
</div>
|
||||||
|
<div class="ui field">
|
||||||
|
<input type="text" name="paramValues" placeholder="参数值" v-model="param.value" style="width:16em"/>
|
||||||
|
</div>
|
||||||
|
<div class="ui field" style="padding:0">
|
||||||
|
<a href="" title="删除" @click.prevent="removeParam(index)"><i class="ui icon remove"></i> </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="comment" v-if="params.length > 0">可以在参数值中使用一些变量<a href="http://teaos.cn/doc/proxy/Fastcgi.md#%E5%8F%82%E6%95%B0%E5%8F%98%E9%87%8F" target="_blank">点这里查看</a> 。</p>
|
||||||
|
|
||||||
|
<button class="ui button tiny" type="button" @click.prevent="addParam()">+</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<more-options-indicator></more-options-indicator>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tbody v-show="moreOptionsVisible">
|
||||||
|
<tr>
|
||||||
|
<td>读取超时时间</td>
|
||||||
|
<td>
|
||||||
|
<div class="ui right labeled input" style="width:7em">
|
||||||
|
<input type="number" name="readTimeout" maxlength="10" placeholder="比如 30" v-model="fastcgi.readTimeout.count"/>
|
||||||
|
<span class="ui basic label">秒</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>连接池尺寸</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="poolSize" value="0" maxlength="4" style="width:7em" v-model="fastcgi.poolSize"/>
|
||||||
|
<p class="comment">0表示不限制,通常可以设置为CPU数量的两倍</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>PATH_INFO匹配</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="pathInfoPattern" maxlength="100" v-model="fastcgi.pathInfoPattern"/>
|
||||||
|
<p class="comment">匹配PATH_INFO的正则表达式,用括号表示匹配的内容,如果只有一个匹配括号表示第一个括号为${fastcgi.pathInfo}值;如果有两个或两个以上的匹配括号,则第一个表示匹配的是${fastcgi.filename},第二个匹配的是${fastcgi.pathInfo},比如(\w+\.php)(.+)$。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>是否启用</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="isOn" value="1" v-model="fastcgi.isOn"></checkbox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.params = this.fastcgi.params
|
||||||
|
if (this.params == null) {
|
||||||
|
this.params = []
|
||||||
|
} else {
|
||||||
|
this.params.forEach(function (v) {
|
||||||
|
switch (v.name) {
|
||||||
|
case "DOCUMENT_ROOT":
|
||||||
|
v.nameZh = "文档目录"
|
||||||
|
break;
|
||||||
|
case "SCRIPT_FILENAME":
|
||||||
|
v.nameZh = "脚本文件"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.addParam = function () {
|
||||||
|
this.params.push({
|
||||||
|
"name": "",
|
||||||
|
"value": "",
|
||||||
|
"nameZh": ""
|
||||||
|
})
|
||||||
|
this.$delay(function () {
|
||||||
|
this.$find("form input[name='paramNames']").last().focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.removeParam = function (index) {
|
||||||
|
this.params.$remove(index)
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{$layout}
|
||||||
|
{$template "/left_menu"}
|
||||||
|
|
||||||
|
<div class="right-box">
|
||||||
|
{$template "../location_menu"}
|
||||||
|
{$template "../left_menu"}
|
||||||
|
|
||||||
|
<div class="right-box tiny">
|
||||||
|
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||||
|
<input type="hidden" name="webId" :value="webId"/>
|
||||||
|
<http-fastcgi-box :v-fastcgi-ref="fastcgiRef" :v-fastcgi-configs="fastcgiConfigs" :v-is-location="true"></http-fastcgi-box>
|
||||||
|
<submit-btn></submit-btn>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.success = NotifyReloadSuccess("保存成功")
|
||||||
|
})
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th style="width:1em"></th>
|
<th style="width:1em"></th>
|
||||||
<th>匹配规则</th>
|
<th>匹配规则</th>
|
||||||
|
<th class="two wide">匹配类型</th>
|
||||||
<th class="two wide">状态</th>
|
<th class="two wide">状态</th>
|
||||||
<th class="two op">操作</th>
|
<th class="two op">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
{{location.pattern}}
|
{{location.pattern}}
|
||||||
<http-location-labels :v-location-config="location" :v-server-id="serverId"></http-location-labels>
|
<http-location-labels :v-location-config="location" :v-server-id="serverId"></http-location-labels>
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{location.patternTypeName}}</td>
|
||||||
<td>
|
<td>
|
||||||
<label-on :v-is-on="location.isOn"></label-on>
|
<label-on :v-is-on="location.isOn"></label-on>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user