azure - 在 azure 上为 https 配置 golang rest api 应用程序

标签 azure go https ssl-certificate

嗨,我是 golang 和 azure 的新手。我已经构建了一个 golang rest api 应用程序,并在本地使用以下命令将其作为 http 运行:
http.ListenAndServe(":4000", nil)
在 azure 中,我需要使用 https,以便我使用:
http.ListenAndServeTLS(":10443", cert.pem, key.crt, nil)
在我的本地计算机中,我创建了一个自签名证书,并且可以找到证书和 key 文件。但是在 azure 中,如何添加自签名证书以及如何在 ListenAndServeTLS 函数中传递这两个参数。任何帮助表示赞赏。

最佳答案

您应该在 Windows Azure 服务器上重新创建本地环境。
假设您在本地需要以下文件来执行您的应用程序:

appDir/
appDir/cert.pem
appDir/cert.key
appDir/appExecutable

您只需在服务器上移动所有这些数据(例如通过 scp ),然后在其上执行应用程序,注意打开端口 的传入流量10443 通过你的服务器

关于azure - 在 azure 上为 https 配置 golang rest api 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60380634/

相关文章:

go - Framework7与Golang模板解析器的代码冲突

string - string.Contains函数无法在我的golang代码中正常工作。尽管第一个字符串包含第二个字符串,但条件失败

ssl - 使用 nginx 配置为我的服务器上的单个目录强制使用 https

Http 到 Https POST

.net - 如何保护Azure存储/服务总线中的访问 key

sql - 如何从 azure databricks SQL 中的日期中提取工作日名称(例如,moday、tuesday)?

sql-server - Azure SQL Server : There are multiple execution plans created if the Stored Procedure Option (Keep Plan) is set

http - 服务器启动时记录

node.js - HTTPs 与用于 SPA 的expressjs staticFile

sql-server - Azure 数据库需要更改防火墙,但设置中缺少