FAQ
I want to server two domains from same machine.
In the domain registrar I pointed the two domains to same IP address.

On the Golang server I have this running for https://www.MyDomain01.net.

How to modify it to listen also to https://www.MyDomain02.net?
I have certpem01 and keypem01 for MyDomain01 and
certpem02 and keypem02 for MyDomain02.

The question is how to serve both domains from same machine.

===================================

       var addr01 string = "www.MyDomain01.net"

        cert01, err01 := tls.LoadX509KeyPair(certpem01, keypem01) if err01
!= nil { fmt.Printf("LoadX509KeyPair: %s", err01) }

config01 := &tls.Config{
Rand: rand.Reader,
Certificates: []tls.Certificate{cert01},
CipherSuites: []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
},
}

         srv01 := &http.Server{}
ln4_01, err01 := net.Listen("tcp4", addr01 +":443")
if err01 != nil {
fmt.Printf("\n Error:net.Listen(tcp4): %s", err01)
}
tlsListener4_01 :=
tls.NewListener(tcpKeepAliveListener{ln4_01.(*net.TCPListener)}, configTc)
go func() {
srvTc.Serve(tlsListener4_01)
}()
===================================

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 8, '16 at 4:47p
activeApr 9, '16 at 1:57a
posts3
users2
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase