2017-02-13 26 views
0

在我的linode盒子上,我安装了Let's Encrypt SSL证书并创建了一个裸机Vibe.d应用程序来测试我的SSL连接。我总是超时。下面是代码:Vibe.d上的HTTPS

import vibe.vibe; 

void main() 
{ 
     auto settings = new HTTPServerSettings; 
     settings.port = 8080; 
     settings.bindAddresses = ["::1", "127.0.0.1","50.116.15.145"]; 
     settings.tlsContext = createTLSContext(TLSContextKind.server); 
     settings.tlsContext.useCertificateChainFile("/etc/letsencrypt/live/findyourtutor.info/cert.pem"); 
     settings.tlsContext.usePrivateKeyFile("/etc/letsencrypt/live/findyourtutor.info/privkey.pem"); 
     listenHTTP(settings, &hello); 

     logInfo("Please open 'http://www.findyourtutor.info' in your browser."); 
     runApplication(); 
} 

void hello(HTTPServerRequest req, HTTPServerResponse res) 
{ 
     res.writeBody("Hello, World!"); 
} 

如果我只需访问

www.findyourtutor.info or 
findyourtutor.info 

我可以细查看。

但是,如果我访问https://findyourtutor.info,我超时。

我也超时与

https://findyourtutor.info:8080 
https://www.findyourtutor.info 
https://www.findyourtutor.info:8080 

当的Linode登录,我可以做

lynx https://localhost:8080 

和山猫提醒我有关的证书,但按“Y”后,我可以看到网站两次。

我还可以做

lynx http://localhost 

但不

lynx http://localhost:8080 

在这一点上,我不知道如果我的代码是错误的或我的设置是错误的。

我的UFW防火墙允许从任何地方使用HTTPS。

回答

2

我会使用nginx作为您的vibe-d应用程序的代理,这是更好的方法,然后尝试使用ssl使用vibed。

但是你的设置似乎很奇怪。您正在8080上收听,所以不应该可以通过 www.findyourtutor.infofindyourtutor.info来访问您的网站,而无需指定端口,所以我想还有其他一些网络服务器正在播放。如果你想使用https,你应该试着听443。或者你有没有准备好一些代理?

+0

感谢您的回答,@ Kozzi11。是的,它似乎很奇怪,但它以某种方式起作用。我会尝试你的建议。 –

+0

Hi @ Kozzi11,我发现我的程序在发出ps aux后有多个实例,其中一个在80端口监听!所以我重新启动了我的linode,现在一切都更清晰了。 –