Browse Source

增加https访问

xusl 7 tháng trước cách đây
mục cha
commit
713ec4d370

+ 40 - 1
cpp-admin/pom.xml

@@ -65,7 +65,25 @@
             <artifactId>spring-boot-starter-thymeleaf</artifactId>
         </dependency>
     </dependencies>
+    <profiles>    <!--考虑到window 和linux环境 npm命令格式的问题,使用maven的profile实现动态指定命令-->
+        <profile>
+            <id>window</id>
+            <properties>
+                <npm>npm.cmd</npm>
+            </properties>
 
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+
+        </profile>
+        <profile>
+            <id>linux</id>
+            <properties>
+                <npm>npm</npm>
+            </properties>
+        </profile>
+    </profiles>
 
     <build>
         <finalName>cpp</finalName>
@@ -79,7 +97,28 @@
                     <skipTests>true</skipTests>
                 </configuration>
             </plugin>
-
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.6.0</version>
+                <executions>
+                    <execution>
+                        <id>exec-npm-run-build</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>${npm}</executable>
+                            <arguments>
+                                <argument>run</argument>
+                                <argument>build:prod</argument>
+                            </arguments>
+                            <workingDirectory>${project.parent.basedir}/cpp-ui</workingDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <!--资源插件,主要为了从前端项目里复制打包好的文件到springboot项目-->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

+ 6 - 0
cpp-admin/src/main/resources/application.yml

@@ -17,6 +17,12 @@ ruoyi:
 server:
   # 服务器的HTTP端口,默认为8080
   port: 8080
+  ssl:
+    key-store: classpath:ipfcst.keystore
+    key-store-type: JKS
+    key-store-password: jiayue6677*
+    enabled-protocols: "TLSv1.2"
+    ciphers: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
   servlet:
     # 应用的访问路径
     context-path: /

BIN
cpp-admin/src/main/resources/ipfcst.keystore


+ 1 - 1
cpp-ui/vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://localhost:8080`,
+        target: `https://localhost:8080`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''