建设企业网站包含什么,北京网站建设开发,微信公众号后天网站开发,中国企业公司网站建设在项目上本来一直使用的是http协议,后来因为安全和一些其他原因需要上https协议#xff0c;如果发布项目之后想同时兼容http和https协议需要更改一下配置信息#xff0c;下面一起看一下#xff1a;
1.安装服务器证书
首先你需要先申请一张服务器证书#xff0c;申请后将证…在项目上本来一直使用的是http协议,后来因为安全和一些其他原因需要上https协议如果发布项目之后想同时兼容http和https协议需要更改一下配置信息下面一起看一下
1.安装服务器证书
首先你需要先申请一张服务器证书申请后将证书安装到服务器上(也可以在iis中选择服务器证书导入)。
直接安装到服务器的方式
或者在iis中导入服务器证书
2.修改appsettings.json文件
添加Urls节点节点中配置http端口和https端口 App节点中的地址默认为localhost就可以
{App: {SelfUrl: http://localhost:44386, CorsOrigins: https://*.aaa.com,http://localhost:4200,https://localhost:44307,http://localhost:8080,http://192.168.0.86:8080,RedirectAllowedUrls: http://localhost:4200,https://localhost:44307},ConnectionStrings: { Default: Server111.111.11.11; DatabaseTest; Persist Security InfoTrue;User IDsa;Password123;Packet Size512;},Redis: {RedisConnectionString: 111.111.11.11:6379,password12312312313,ConnectTimeout15000,SyncTimeout5000},AuthServer: {Authority: http://localhost:44386,RequireHttpsMetadata: false,SwaggerClientId: Test_Swagger,SwaggerClientSecret: 1123},StringEncryption: {DefaultPassPhrase: paaaaaaa},Urls: {Http: {Host: localhost,Port: 44386},Https: {Host: localhost,Port: 447}},Settings: {Abp.Mailing.Smtp.Host: 127.0.0.1,Abp.Mailing.Smtp.Port: 25,Abp.Mailing.Smtp.UserName: ,Abp.Mailing.Smtp.Password: ,Abp.Mailing.Smtp.Domain: ,Abp.Mailing.Smtp.EnableSsl: false,Abp.Mailing.Smtp.UseDefaultCredentials: true,Abp.Mailing.DefaultFromAddress: noreplyabp.io,Abp.Mailing.DefaultFromDisplayName: ABP application,Abp.Identity.Lockout.MaxFailedAccessAttempts: 20,Abp.Identity.Lockout.LockoutDuration: 180,//Abp.Identity.Password.RequiredUniqueChars: false,Abp.Identity.Password.RequireNonAlphanumeric: false,//Abp.Identity.Password.RequireLowercase: false,Abp.Identity.Password.RequireUppercase: false,Abp.Identity.Password.RequireDigit: false}
}3.修改Program.cs文件
把http和https的地址和端口配置到webBuilder.UseUrls(“http://localhost:44386”, “https://localhost:447”).UseStartup(); 中
internal static IHostBuilder CreateHostBuilder(string[] args) Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder {webBuilder.UseUrls(http://localhost:44386, https://localhost:447).UseStartupStartup();}).UseAutofac().UseSerilog();4.发布到iis配置http和https端口
在绑定https协议时SSL证书需要选择第一步导入的证书
如果你的域名绑定了ip 那么你既可以用http的IP去访问 也可以用https的IP去访问 还可以用域名加端口去访问