1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 12:50:55 +00:00

Allow to use fastcgi via standard io.

This commit is contained in:
Jens Bissinger 2014-10-13 13:47:44 +02:00
parent a760e46f98
commit 812950b60d
2 changed files with 18 additions and 7 deletions

23
app.go
View File

@ -55,15 +55,24 @@ func (app *App) Run() {
endRunning := make(chan bool, 1) endRunning := make(chan bool, 1)
if UseFcgi { if UseFcgi {
if HttpPort == 0 { if UseStdIo {
l, err = net.Listen("unix", addr) err = fcgi.Serve(nil, app.Handlers) // standard I/O
if err == nil {
BeeLogger.Info("Use FCGI via standard I/O")
} else {
BeeLogger.Info("Cannot use FCGI via standard I/O", err)
}
} else { } else {
l, err = net.Listen("tcp", addr) if HttpPort == 0 {
l, err = net.Listen("unix", addr)
} else {
l, err = net.Listen("tcp", addr)
}
if err != nil {
BeeLogger.Critical("Listen: ", err)
}
err = fcgi.Serve(l, app.Handlers)
} }
if err != nil {
BeeLogger.Critical("Listen: ", err)
}
err = fcgi.Serve(l, app.Handlers)
} else { } else {
app.Server.Addr = addr app.Server.Addr = addr
app.Server.Handler = app.Handlers app.Server.Handler = app.Handlers

View File

@ -61,6 +61,7 @@ var (
SessionAutoSetCookie bool // auto setcookie SessionAutoSetCookie bool // auto setcookie
SessionDomain string // the cookie domain default is empty SessionDomain string // the cookie domain default is empty
UseFcgi bool UseFcgi bool
UseStdIo bool
MaxMemory int64 MaxMemory int64
EnableGzip bool // flag of enable gzip EnableGzip bool // flag of enable gzip
DirectoryIndex bool // flag of display directory index. default is false. DirectoryIndex bool // flag of display directory index. default is false.
@ -241,6 +242,7 @@ func init() {
SessionAutoSetCookie = true SessionAutoSetCookie = true
UseFcgi = false UseFcgi = false
UseStdIo = false
MaxMemory = 1 << 26 //64MB MaxMemory = 1 << 26 //64MB