From 049b8b13e98afff4d3a30fa07627a53b2dcd78c7 Mon Sep 17 00:00:00 2001 From: chy <‘chy_aurora1111@163.com’> Date: Wed, 17 Aug 2022 18:47:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0https=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/RuoYiApplication.java | 36 ++++++++++++++++++ .../src/main/resources/application.yml | 7 +++- .../resources/tongue.nanjingyinuo.com.jks | Bin 0 -> 5424 bytes 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 ruoyi-admin/src/main/resources/tongue.nanjingyinuo.com.jks diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 935f879..7720153 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -1,8 +1,14 @@ package com.ruoyi; +import org.apache.catalina.Context; +import org.apache.catalina.connector.Connector; +import org.apache.tomcat.util.descriptor.web.SecurityCollection; +import org.apache.tomcat.util.descriptor.web.SecurityConstraint; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; +import org.springframework.context.annotation.Bean; /** * 启动程序 @@ -17,4 +23,34 @@ public class RuoYiApplication SpringApplication.run(RuoYiApplication.class, args); System.out.println("(♥◠‿◠)ノ゙ ---tongue---启动成功 ლ(´ڡ`ლ)゙ "); } + + + @Bean + public TomcatServletWebServerFactory servletContainer() { //springboot2 新变化 + + TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { + + @Override + protected void postProcessContext(Context context) { + + SecurityConstraint securityConstraint = new SecurityConstraint(); + securityConstraint.setUserConstraint("CONFIDENTIAL"); + SecurityCollection collection = new SecurityCollection(); + collection.addPattern("/*"); + securityConstraint.addCollection(collection); + context.addConstraint(securityConstraint); + } + }; + tomcat.addAdditionalTomcatConnectors(initiateHttpConnector()); + return tomcat; + } + + private Connector initiateHttpConnector() { + Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); + connector.setScheme("http"); + connector.setPort(8888); + connector.setSecure(false); + connector.setRedirectPort(9080); + return connector; + } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index fa24ed4..881a0f4 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -18,7 +18,9 @@ ruoyi: # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 - port: 8091 + port: 9080 + http: + port: 8888 servlet: # 应用的访问路径 context-path: / @@ -32,6 +34,9 @@ server: max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 + ssl: + key-store: tongue.nanjingyinuo.com.jks + key-store-password: 123456 # 日志配置 logging: diff --git a/ruoyi-admin/src/main/resources/tongue.nanjingyinuo.com.jks b/ruoyi-admin/src/main/resources/tongue.nanjingyinuo.com.jks new file mode 100644 index 0000000000000000000000000000000000000000..b63883dd4a29ae7ea0700a44532ab46aa6ad3c32 GIT binary patch literal 5424 zcmd6qcT^MGy1+AOAVsS55O|?C?5Q7C(zJSIgZbhxqgar*+XfoV$J_P*sTh0AFR<Vb{?x8f=S&=m6 z6Kn0VluY(Ng07Vke_ew==RnP79;ru2x&{)HA)v_a0>lk_t;LcO-{( zrwNH^x@LK@A=eM6RToPf>j;1YCK~jW8@aZ44drgH#8aCscI2{hUYQnuD^W!5$SK1E?>1JUK0R^p%ku>S6YuuE5iZ zZ^GHdibv&c;k}I{XrI*c%+gW?PNiF(nAPuB-prKYu}Ad3vtIkETrIt9O?Aw0&GriI z$imCpZ~5&j65dSkCZg6EBMZDc^>^v)#u9yGOgzqT1}c3GG{;&S_>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