From ae9b02b079954eabafc55ff1ab7527ba828f4bb6 Mon Sep 17 00:00:00 2001 From: Pavel Korovin Date: Thu, 23 Mar 2017 10:57:43 +0300 Subject: [PATCH] Fix FCGI (over TCP) support (#1368) --- cmd/web.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/web.go b/cmd/web.go index 5af9ad9f2df..3a20191bc5d 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -701,7 +701,12 @@ func runWeb(ctx *cli.Context) error { case setting.HTTPS: err = runHTTPS(listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m)) case setting.FCGI: - err = fcgi.Serve(nil, context2.ClearHandler(m)) + listener, err := net.Listen("tcp", listenAddr) + if err != nil { + log.Fatal(4, "Failed to bind %s", listenAddr, err) + } + defer listener.Close() + err = fcgi.Serve(listener, context2.ClearHandler(m)) case setting.UnixSocket: if err := os.Remove(listenAddr); err != nil && !os.IsNotExist(err) { log.Fatal(4, "Failed to remove unix socket directory %s: %v", listenAddr, err)