一、下载Nginx格式的SSL证书。

yourdomain.com.crt

yourdomain.com.key

二、Golang使用SSL证书 Demo

package main

import (

"crypto/tls"

"log"

"net/http"

)

func main() {

server := http.NewServeMux()

server.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {

w.Write([]byte("Hello World!! \n"))

})

cfg := &tls.Config{

MinVersion: tls.VersionTLS12,