golang-nuts › acme, letsencrypt and different HTTPS ports

xuanbao · · 436 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have an EC2 vm where I want to run two go https servers on different ports.</p> <p>I am using letsencrypt for the certificates and the code is like:</p> <pre><code>server1.go: log.Fatal(http.Serve(autocert.NewListener(&#34;api1.example.com&#34;), http.DefaultServeMux)) server2.go: log.Fatal(http.Serve(autocert.NewListener(&#34;api2.example.com&#34;), http.DefaultServeMux)) </code></pre> <p>I want api1 to listen on port 443 and want api2 to listed on port 8080. Is it possible to achieve this via autocert at all ? If not, are there any other hacks to get multiple ports exposed from the same machine using letsencrypt ? I am deploying server1.go manually (via a systemd script) and server2 via a docker container, if it matters.</p> <p>Any help ? Thanks.</p> <hr/>**评论:**<br/><br/>i_regret_most_of_it: <pre><p>Are you sure you want them to be on different ports?</p> <p>You can just host both on :443:</p> <pre><code>autocert.NewListener(&#34;api1.example.com&#34;, &#34;api2.example.com&#34;) </code></pre> <p>and deal with the different hostnames in your handlers.</p> <p>But the post on go-nuts is right - autocert won&#39;t help you if need to work outside of the limitations of the http-01 challenge.</p></pre>psankar: <pre><p>Those two different processes with different release timelines. I just simplified for brevity. Thanks :)</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

436 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传