Created
December 20, 2014 05:33
-
-
Save kenegozi/51e858229a3f3eb1c554 to your computer and use it in GitHub Desktop.
fcgi playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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