I have pretty simple go https web server
Here is code:
package main
import (
// "fmt"
// "io"
"net/http"
"log"
)
func HelloServer(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("This is an example server.
"))
// fmt.Fprintf(w, "This is an example server.
")
// io.WriteString(w, "This is an example server.
")
}
func main() {
http.HandleFunc("/hello", HelloServer)
err := http.ListenAndServeTLS(":8085", "fullchain.pem", "privkey.pem", nil)
// err := http.ListenAndServeTLS(":8085", "certificate_ca.crt", "certificate.csr", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
It listens on port 8085 which is open by farewall. I use SSL certificate generated by certbot:
sudo certbot certonly --standalone -d example.com
So I built web server using following generated files:
err := http.ListenAndServeTLS(":8085", "fullchain.pem", "privkey.pem", nil)
Here is port state:
$ sudo netstat -tulpn | grep 8085
tcp6 0 0 :::8085 :::* LISTEN 23429/hello
$ sudo ufw status | grep 8085
8085/tcp ALLOW Anywhere
8085/tcp (v6) ALLOW Anywhere (v6)
So when I try to from another machine:
$ curl -sL https://example.com:8085
404 page not found
Web server run on DigitalOcean. Do I need to configure my droplet somehow? Not sure what I missed?
Also I have certificate.crt, certificate_ca.crt, certificate.csr
files I got from company that sold me domain. Should I use this files someway?
I need this for OAuth redirect URI.