mirror of
https://gitee.com/johng/gf
synced 2026-06-27 09:47:19 +08:00
ghttp.Server增加对多端口监听特性(HTTP/HTTPS),支持同一Server同时监听多端口的HTTP/HTTPS服务
This commit is contained in:
16
geg/net/ghttp/https/https_http.go
Normal file
16
geg/net/ghttp/https/https_http.go
Normal file
@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"gitee.com/johng/gf/g/net/ghttp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := ghttp.GetServer()
|
||||
s.BindHandler("/", func(r *ghttp.Request){
|
||||
r.Response.Writeln("您可以同时通过HTTP和HTTPS方式看到该内容!")
|
||||
})
|
||||
s.EnableHTTPS("/home/john/temp/server.crt", "/home/john/temp/server.key")
|
||||
s.SetHTTPSPort(443)
|
||||
s.SetPort(80)
|
||||
s.Run()
|
||||
}
|
||||
Reference in New Issue
Block a user