Apache와 Nginx에서 SSL 파일 형식 통합하기

apache와 nginx에서 쓰는 SSL 파일형식이 다름. 각각 만들어줘야 하지만, 통합해서 쓸 수 있는 방법이 있다.

인증서와 체인 파일을 하나로 합친 파일을 생성하고, 이를 웹 서버에서 공통적으로 사용하도록 설정하면 된다.

cat star_crt.pem ChainCA.crt RootCA.crt > fullchain.pem

fullchain.pem 파일과 Private.key 파일을 웹 서버 설정

apache 설정

<VirtualHost *:443>
    ServerName example.com

    SSLEngine on
    SSLCertificateFile /path/to/fullchain.pem
    SSLCertificateKeyFile /path/to/Private.key
</VirtualHost>

nginx 설정

server {
    listen 443 ssl;
    server_name example.com;

    ssl_certificate /path/to/fullchain.pem;
    ssl_certificate_key /path/to/Private.key;
}

✅ AWS SSL 인증서 등록하기

1. SSL 인증서(AWS 콘솔에서 “Certificate body”):

star_newssalad_com_crt.pem 파일의 내용을 사용합니다. 이 파일은 기본 인증서 파일입니다.

2. 중간 인증서 (AWS 콘솔에서 “Certificate chain”):

ChainCA.crt와 RootCA.crt 파일을 결합한 내용을 사용해야 합니다. 이 두 파일을 합쳐서 중간 인증서로 등록하면 됩니다.

cat ChainCA.crt RootCA.crt > certificate_chain.pem

3. 개인 키 (AWS 콘솔에서 “Certificate private key”):

Private.key 파일의 내용을 사용합니다.


  • Certificate body: star_newssalad_com_crt.pem의 내용
  • Certificate chain: certificate_chain.pem의 내용 (위에서 생성한 파일)
  • Certificate private key: Private.key의 내용

암호화된 개인 키 복호화

만약 .key 파일이 암호화되어 있다면, AWS에서는 복호화된 개인 키가 필요합니다. 개인 키가 암호화된 경우 openssl 명령을 사용해 암호를 제거할 수 있습니다.

openssl rsa -in Private.key -out Private_unencrypted.key

댓글

댓글 남기기