From 7b1d746ce70380ee0dcf562a50ec60bfd7cb5b40 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:16:25 +0800 Subject: [PATCH] feat(website): Optimize website error_log configuration (#7173) Refs **https://github.com/1Panel-dev/1Panel/issues/7161** --- backend/app/service/website.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/app/service/website.go b/backend/app/service/website.go index 6f7a0bb57..c80527c18 100644 --- a/backend/app/service/website.go +++ b/backend/app/service/website.go @@ -1052,19 +1052,19 @@ func (w WebsiteService) OpWebsiteLog(req request.WebsiteLogReq) (*response.Websi res.Content = strings.Join(lines, "\n") return res, nil case constant.DisableLog: - key := "access_log" + params := dto.NginxParam{} switch req.LogType { case constant.AccessLog: + params.Name = "access_log" + params.Params = []string{"off"} website.AccessLog = false case constant.ErrorLog: - key = "error_log" + params.Name = "error_log" + params.Params = []string{"/dev/null", "crit"} website.ErrorLog = false } var nginxParams []dto.NginxParam - nginxParams = append(nginxParams, dto.NginxParam{ - Name: key, - Params: []string{"off"}, - }) + nginxParams = append(nginxParams, params) if err := updateNginxConfig(constant.NginxScopeServer, nginxParams, &website); err != nil { return nil, err