카테고리 없음

(해결!)nginx, springboot NET::ERR_SSL_PROTOCOL_ERROR/ NET::ERR_CERT_AUTHORITY_INVALID 문제

Devops mg 2020. 8. 10. 18:57

linux 에서 springboot와

vue를 배포한 nginx 를 https 로 만들어야했다. 인스타그램 Graph API 적용을 위해.. (페이스북 로그인을 구현 하려면,  https 가 필수적이다.)

 

하지만, http 로 할땐  프론트(vue)  -> 백엔드 (springboot) 로 Get 요청이 잘갔었는데, 

vue 를 https 로 바꾸니, 

https와 http 가 mix 되었다며 에러가 떴다. 

GET 요청할때 https 로 보내주니 mix 에러는 안떴는데, 

이제는 NET::ERR_SSL_PROTOCOL_ERROR 가 떴다. 

 

보안 박사님 우리 매형께 여쭤보니, springboot에는 SSL 설정이 없다는 걸 집어 주셨고, 

springboot 에도 https 를 적용하였다. 

아래는 https 적용법이다. 

결론부터 말하면 아래 https://galid1.tistory.com/612 를 따라했더니 해결되었다.

 

< HTTPS로 변경하는 법 >

FM 방식은 SecureSign : 공식 인증서를 받는 것이다.

https://www.securesign.kr/guides/Spring-Boot-SSL-Certificate-Install 

하지만, 나는 돈이 없어서 무료 방식을 찾아나섰다. -> 이게 공식문서가 아니라 블로그 발품 팔아가며 찾아서 오래걸렸다..

 

단언컨데,

 https://galid1.tistory.com/612  블로그가 짱이다. 이 블로그를 따라하면 

아름다운 초록색을 볼 수 있다. 

 

 

아래 글은 빠르게 적용하기에는 좋다.

하지만, 최종결과물은 "주의요함" 으로 뜰것이다.

https://ayoteralab.tistory.com/entry/Spring-Boot-24-https-TLS-SSL-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0  

 


fullchain.pem 키와 

privatekey 로 p12 키 만드는법 

sudo openssl pkcs12 -export -in { fullchain.pem 위치 } -inkey  { privkey.pem 위치 } -out {새로만들 p12 이름} -name {alias 명} -CAfile chain.pem -caname root
sudo openssl pkcs12 -export -in /etc/letsencrypt/live/applemango/fullchain.pem -inkey  /etc/letsencrypt/live/applemango.io/privkey.pem -out applemango.p12 -name project -CAfile chain.pem -caname root

출처:

https://galid1.tistory.com/612