github.com/gogf/gf@v1.16.9/.example/net/ghttp/server/reload/https_http.go (about) 1 package main 2 3 import ( 4 "github.com/gogf/gf/net/ghttp" 5 ) 6 7 func main() { 8 s := ghttp.GetServer() 9 s.EnableAdmin() 10 s.BindHandler("/", func(r *ghttp.Request) { 11 r.Response.Writeln("您可以同时通过HTTP和HTTPS方式看到该内容!") 12 }) 13 s.EnableHTTPS("/home/john/temp/server.crt", "/home/john/temp/server.key") 14 s.SetHTTPSPort(8198, 8199) 15 s.SetPort(8200, 8300) 16 s.EnableAdmin() 17 s.Run() 18 }