Skip to content

Instantly share code, notes, and snippets.

@kenegozi
Created December 20, 2014 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenegozi/51e858229a3f3eb1c554 to your computer and use it in GitHub Desktop.
Save kenegozi/51e858229a3f3eb1c554 to your computer and use it in GitHub Desktop.
fcgi playground
<add name="fcgi-golang" path="*.go" verb="*" modules="FastCgiModule" scriptProcessor="c:\w\playground\go-iis\std.exe" resourceType="Either" requireAccess="Read" />
<fastCgi>
<application fullPath="c:\w\playground\go-iis\std.exe"
arguments=""
maxInstances="1"
idleTimeout="300"
activityTimeout="30"
requestTimeout="90"
instanceMaxRequests="10000"
protocol="NamedPipe"
flushNamedPipe="false">
<environmentVariables>
<environmentVariable
name="PHP_FCGI_MAX_REQUESTS"
value="10000" />
</environmentVariables>
</application>
</fastCgi>
package main
import (
"io"
"net"
"os"
"net/http"
"net/http/fcgi"
"log"
"fmt"
)
func main() {
fmt.Println(len(os.Args), os.Args)
for _, e := range os.Environ() {
fmt.Println(e)
}
h := func(w http.ResponseWriter,r *http.Request) {
io.WriteString(w,"Hello, world of FCGI!")
}
http.HandleFunc("/hello/", h)
n,_lerr := net.FileListener(os.Stdin)
if _lerr != nil {
log.Fatal("net.FileListener: ", _lerr)
}
err := fcgi.Serve(n,nil)
if err != nil {
log.Fatal("fcgi.Serve: ", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment