如何在Kestrel/linux主机上配置带有aspnet core 3.1的签名SSL证书
我设法获得了一个letsencrypt签名证书,以便在主机上为我的域正确启用SSL。现在我不明白如何将它绑定到运行在ubuntu上的应用程序: 我使用以下方法设置私钥:如何在Kestrel/linux主机上配置带有aspnet core 3.1的签名SSL证书,linux,asp.net-core,ssl,web-hosting,Linux,Asp.net Core,Ssl,Web Hosting,我设法获得了一个letsencrypt签名证书,以便在主机上为我的域正确启用SSL。现在我不明白如何将它绑定到运行在ubuntu上的应用程序: 我使用以下方法设置私钥: webBuilder.UseKestrel((hostingContext, options) => { options.ListenAnyIP(443, loptions => loptions.UseHttps("/etc/letsencrypt/live/mydomain.com/privkey
webBuilder.UseKestrel((hostingContext, options) =>
{
options.ListenAnyIP(443, loptions => loptions.UseHttps("/etc/letsencrypt/live/mydomain.com/privkey.pem"));
});
服务器模式SSL必须使用具有关联私钥的证书
我不清楚如何在不使用apache或nginx的情况下绑定公钥和私钥并远程使用。您首先需要使用OpenSSL将私钥和证书转换为pfx证书: openssl pkcs12-inkey privatekey.pem-in-mycert.cert-export-out-mycertificate.pfx 然后,您可以在Kestrel的appsettings.json文件中以这种方式使用它:
"Kestrel": {
"EndPoints": {
"HttpsDefaultCert": {
"Url": "https://*:443"
},
"Http": {
"Url": "http://*:80"
}
},
"Certificates": {
"Default": {
"Path": "mycertificate.pfx",
"Password": "MyCertificatePassword"
}
}
}
谢谢你,甘比!效果很好