Total Pageviews

Friday, 17 April 2020

一个基于go的简单的静态HTTPServer

package main

import "net/http"

func main() {
        http.ListenAndServe(":2378", http.FileServer(http.Dir(".")))
}

登陆linux vps,把上面的代码保存为httpserver.go ,然后安装go环境,然后运行:
go run httpserver.go

访问http://vps-ip:2378