2017-11-28 4 views
2

나는 Spring Boot에서 https를 활성화하는 가이드를 따라 갔다. 내가 main 메소드를 실행하는 경우를 시작,https 후 스프링 부트 : 포트 8444에서 수신 대기하도록 구성된 Tomcat 커넥터를 시작하지 못했습니다.

# Define a custom port instead of the default 8080 
server.port = 8444 
# Tell Spring Security (if used) to require requests over HTTPS 
security.require-ssl=true 
# The format used for the keystore 
server.ssl.key-store-type:PKCS12 
# The path to the keystore containing the certificate 
server.ssl.key-store=keystore.p12 
# The password used to generate the certificate 
server.ssl.key-store-password=<somepassword> 
# The alias mapped to the certificate 
server.ssl.key-alias=tomcat 

지금 : 응용 프로그램은 사전에 지금과 같은 내 application.properties, 같은 디렉토리에있는 keystore.jks을 만든 https://localhost:8080

작업을했다 봄 부팅 응용 프로그램, 그것은 던졌습니다 :

Description: 

The Tomcat connector configured to listen on port 8444 failed to start. The port may already be in use or the connector may be misconfigured. 

Action: 

Verify the connector's configuration, identify and stop any process that's listening on port 8444, or configure this application to listen on another port. 

포트가 사용되지 않으므로 잘못 구성해야합니까?

변경해야 할 부분이 확실하지 않습니다. 그것은 단순한 SPA 응용 프로그램입니다. Spring은 index.html을 제공하고 하나의 REST 끝점을 가지고 있습니다. 이 경우 https를 받아들이도록 tomcat/spring을 어떻게 구성해야하며 오류없이 시작해야합니까?

+0

'server.ssl.key-store-type' 줄에 작은 유형이 있습니다. 'yml'은':'를 사용합니다. '{file} .properties'는'= ' – oak

+0

을 사용하고 디버그 플래그로 실행을 시도합니다. 일부 숨겨진 오류를 찾는 데 도움이 될 수 있습니다. – oak

+0

동일한 문제가 너무 있습니다. 해결책을 찾았습니까 – Johna

답변

1

나 역시 같은 문제가있어서 고칠 수있었습니다. 내 문제가 keystore.p12 파일을 생성하고있었습니다.

인증서 파일과 개인 키 파일이있는 경우 다음 명령을 사용하여 keystore.p12 파일을 생성 할 수 있습니다.

암호를 묻는 메시지가 나타나면 원하는 암호를 입력 할 수 있습니다. 키 스토어 파일이 생성되면 .jar 파일이있는 디렉토리로 복사하십시오.

다음은 작업 예제 구성입니다.

server.port=8443 
security.require-ssl=true 
server.ssl.key-store-type=PKCS12 
server.ssl.key-store=file:keystore.p12 
server.ssl.key-store-password=<password> 
server.ssl.key-alias=<alias> 

참고가 실행 .jar 파일과 같은 디렉토리에가는 경우 키 저장소 파일 경로 file:keystore.p12.