问题
I have register ssl certificates for server. Insert all certs to /usr/local/share/ca-certificates/
and make update-ca-certificates
.
When app start, I follow by url https_//www.site.org:443 but its not loading.
static void Main(string[] args)
{
var uri = "https://localhost:443";
var host = new NancyHost(new Uri(uri));
host.Start(); // start hosting
if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase)))
{
Thread.Sleep(Timeout.Infinite);
}
else
{
Trictionary.initilizeDic();
Console.ReadKey();
}
host.Stop(); // stop hosting
}
回答1:
Nancy console hosting doesn't support ssl itself, so in order to have ssl, you need to run another web server, which does support ssl. I don't know which OS you use, but let's say it is ubuntu for example. On ubuntu you can run nginx with ssl, like described here and then use proxy_pass to send decrypted request to your console app. Official documentation explains how to set up nginx and nancy combination. Your basic scenario would be:
- Set up Nancy Console App
- Set up and configure ssl enabled web server to pass requests to your nancy app
- Use some control app to make sure that both of them alive all the time
来源:https://stackoverflow.com/questions/31980202/how-configure-nancyfx-with-https