nginx 配置
server {
listen 80;
server_name go.dev;
root /root/go/src/godev;
index index.html;
#gzip off;
#proxy_buffering off;
location / {
try_files $uri $uri/;
}
location ~ /app.* {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9001;
}
try_files $uri $uri.html =404; } <!-- more --> fastcgi程序:
package main
import (
“net”
“net/http”
“net/http/fcgi”
)
type FastCGI struct{}
func (s *FastCGI) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
resp.Write([]byte(“Hello, fastcgi”))
}
func main() {
listener, _ := net.Listen(“tcp”, “127.0.0.1:8989”)
srv := new(FastCGI)
fcgi.Serve(listener, srv)
select {}
}
https://github.com/yookoala/gofast