加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

GOLANG 实现的 fastcgi

发布时间:2020-12-16 18:58:00 所属栏目:大数据 来源:网络整理
导读: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


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;
}



package main

import (
"net"
"net/http"
"net/http/fcgi"
)
type FastCGIServer struct{}
func (s FastCGIServer) ServeHTTP(resp http.ResponseWriter,req *http.Request) {
resp.Write([]byte("<h1>Hello,世界</h1>n<p>Behold my Go web app.</p>"))
}
func main() {
listener,_ := net.Listen("tcp","127.0.0.1:9001")
srv := new(FastCGIServer)
fcgi.Serve(listener,srv)
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读