使用反向代理Nginx在GoLang中实现SSL

huangapple go评论70阅读模式
英文:

SSL with GoLang using reverse proxy Nginx

问题

我目前正在编写一个 GoLang 网站,希望尽快添加 SSL。我的问题是,使用内置的 Golang SSL 包有什么优缺点,或者我是否可以只使用 nginx 来进行反向代理时进行 SSL?

英文:

I am currently writing a GoLang website and would like to add SSL soon. My question is what are the advantages/disadvantages of using the built-in Golang SSL packages or should/can I just do SSL with the nginx when I use it for the reverse proxy?

答案1

得分: 6

这是翻译好的内容:

最终决定权在你手中,但是nginx的SSL配置非常灵活、经过实战验证且性能出色。

  • nginx可以提供SSL会话缓存以提升性能 - ssl_session_cache
  • 良好的密码兼容性
  • 我相信nginx的SSL实现比Go的更快(更高的请求数/秒和更低的CPU使用率),但我自己没有进行过测试。考虑到nginx项目的成熟度,这并不令人意外。
  • 其他好处包括对代理和静态内容的响应缓存。

当然,缺点是它是另一个需要配置的组件。然而,如果你已经计划使用nginx作为反向代理,我建议你也将其用于SSL。

英文:

It is ultimately up to you, but nginx's SSL configuration is extremely configurable, battle-tested and performant.

  • nginx can provide an SSL session cache to boost performance - ssl_session_cache
  • Good cipher compatibility
  • I believe that nginx's SSL implementation is faster (more req/s and less CPU) than Go's, but have not tested this myself. This would not be surprising given maturity of the nginx project.
  • Other benefits like response caching for both proxied and static content.

The downside, of course, is that it's another moving part that requires configuration. If you are already planning to use nginx as a reverse proxy however I would use it for SSL as well.

huangapple
  • 本文由 发表于 2014年7月16日 15:35:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/24774833.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定