Add basic FCGI support

tokarchuk/v1.17
Andy Leap 10 years ago
parent e9875edcad
commit 5094e9501c
  1. 3
      cmd/web.go
  2. 4
      modules/setting/setting.go

@ -9,6 +9,7 @@ import (
"html/template" "html/template"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/fcgi"
"os" "os"
"path" "path"
"strings" "strings"
@ -416,6 +417,8 @@ func runWeb(*cli.Context) {
err = http.ListenAndServe(listenAddr, m) err = http.ListenAndServe(listenAddr, m)
case setting.HTTPS: case setting.HTTPS:
err = http.ListenAndServeTLS(listenAddr, setting.CertFile, setting.KeyFile, m) err = http.ListenAndServeTLS(listenAddr, setting.CertFile, setting.KeyFile, m)
case setting.FCGI:
err = fcgi.Serve(nil, m)
default: default:
log.Fatal(4, "Invalid protocol: %s", setting.Protocol) log.Fatal(4, "Invalid protocol: %s", setting.Protocol)
} }

@ -28,6 +28,7 @@ type Scheme string
const ( const (
HTTP Scheme = "http" HTTP Scheme = "http"
HTTPS Scheme = "https" HTTPS Scheme = "https"
FCGI Scheme = "fcgi"
) )
var ( var (
@ -181,6 +182,9 @@ func NewConfigContext() {
CertFile = Cfg.MustValue("server", "CERT_FILE") CertFile = Cfg.MustValue("server", "CERT_FILE")
KeyFile = Cfg.MustValue("server", "KEY_FILE") KeyFile = Cfg.MustValue("server", "KEY_FILE")
} }
if Cfg.MustValue("server", "PROTOCOL") == "fcgi" {
Protocol = FCGI
}
Domain = Cfg.MustValue("server", "DOMAIN", "localhost") Domain = Cfg.MustValue("server", "DOMAIN", "localhost")
HttpAddr = Cfg.MustValue("server", "HTTP_ADDR", "0.0.0.0") HttpAddr = Cfg.MustValue("server", "HTTP_ADDR", "0.0.0.0")
HttpPort = Cfg.MustValue("server", "HTTP_PORT", "3000") HttpPort = Cfg.MustValue("server", "HTTP_PORT", "3000")

Loading…
Cancel
Save