Skip to content

请问有证书的话 如何配置 https? 是否可以删除用户? #210

Answered by swuecho
getyougo asked this question in Q&A
Discussion options

You must be logged in to vote

更简单的

Sure, here's how we can create a Golang HTTPS server at port 443:

package main

import (
	"log"
	"net/http"
)

func main() {
	// Set the server parameters
	addr := ":443"
	certFile := "/path/to/cert_file"
	keyFile := "/path/to/key_file"
	
	// Create a new HTTPS server with the given parameters
	server := &http.Server{
		Addr:    addr,
		Handler: nil,
	}
	
	// Start the server
	log.Fatal(server.ListenAndServeTLS(certFile, keyFile))
}

In this code, we create a new HTTPS server using the http.Server struct, which allows us to specify the server address and options. We set the Addr field to :443 to listen to incoming HTTPS requests on that port. We also define the paths for the certific…

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by swuecho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #206 on April 23, 2023 02:13.