Total Pageviews

Saturday 20 October 2018

一个基于go的静态文件服务器程序“http.server”

登陆linux vps.
git clone https://github.com/mohanson/http.server http.server-by-mohanson
cd http.server-by-mohanson


root@umh:~/http.server-by-mohanson# ls
server.go
root@umh:~/http.server-by-mohanson# go build
(会在当前目录下,生成可执行文件http.server-by-mohanson)
root@umh:~/http.server-by-mohanson# ls

http.server-by-mohanson  server.go
root@umh:~/http.server-by-mohanson# 
root@umh:~/http.server-by-mohanson#  ./http.server-by-mohanson -h
Usage of ./http.server-by-mohanson:
  -l string
    listen address (default ":8080")
  -v be verbose
root@umh:~/http.server-by-mohanson# ./http.server-by-mohanson -l 0.0.0.0:9090
2018/10/21 12:33:06 Root /root/http.server-by-mohanson
2018/10/21 12:33:06 Listen and serve on 0.0.0.0:9090

然后在浏览器里访问http://your-vps-ip:9090

项目地址:https://github.com/mohanson/http.server

No comments:

Post a Comment