diff --git a/app.example.ini b/app.example.ini index 496c98d6..2d6f86e3 100644 --- a/app.example.ini +++ b/app.example.ini @@ -14,6 +14,7 @@ AccessLogPath = /var/log/nginx/access.log ErrorLogPath = /var/log/nginx/error.log ConfigDir = PIDPath = +TestConfigCmd = ReloadCmd = RestartCmd = diff --git a/server/internal/nginx/nginx.go b/server/internal/nginx/nginx.go index cf0c554d..db653c73 100644 --- a/server/internal/nginx/nginx.go +++ b/server/internal/nginx/nginx.go @@ -15,6 +15,17 @@ func execShell(cmd string) (out string, err error) { } func TestConf() (string, error) { + if settings.NginxSettings.TestConfigCmd != "" { + out, err := execShell(settings.NginxSettings.TestConfigCmd) + + if err != nil { + logger.Error(err) + return out, err + } + + return out, nil + } + out, err := exec.Command("nginx", "-t").CombinedOutput() if err != nil { logger.Error(err) diff --git a/server/settings/settings.go b/server/settings/settings.go index a07eaa17..21089bfa 100644 --- a/server/settings/settings.go +++ b/server/settings/settings.go @@ -36,6 +36,7 @@ type Nginx struct { ErrorLogPath string `json:"error_log_path"` ConfigDir string `json:"config_dir"` PIDPath string `json:"pid_path"` + TestConfigCmd string `json:"test_config_cmd"` ReloadCmd string `json:"reload_cmd"` RestartCmd string `json:"restart_cmd"` }