Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.