T
T
Terisback2019-06-19 21:35:36
go
Terisback, 2019-06-19 21:35:36

How did the server respond to go when entering a subdomain?

There is a helloworld server in golang and vds with vestaCP on it.

package main

import (
  "fmt"
  "net/http"
)

type msg string

func (m msg) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
  fmt.Fprint(resp, m)
}
func main() {
  msgHandler := msg("Hello from Web Server in Go")
  fmt.Println("Server is listening...")
  http.ListenAndServe(":8181", msgHandler)
}

It is necessary to make the go server respond when someone visits the site's subdomain. (not strong, check)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-06-19
@Terisback

The server on Go has nothing to do with it. Proxy traffic to port 8181 on nginx.
To study - official documentation and articles like this one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question