본문 바로가기

Server Dev

nginx ssl 적용 및 jks pkcs12 추출 및 cert pem, key 만들기





keytool을 이용하여 jks파일에서 pkcs12 포맷형태로  추출


 keytool -importkeystore -srckeystore 파일이름.jks -destkeystore 파일이름.p12 -deststoretype PKCS12



cert 파일 추출

 openssl pkcs12 -in 추출파일이름.p12 -out cert파일이름.pem -clcerts -nokeys


key파일 추출

 $ openssl pkcs12 -in 추출파일이름.p12 -out key파일이름.key -nocerts -des




nginx ssl 설정


    # HTTPS server

    #

    server {

        listen       443 http2 ssl;

        server_name  star.test.co.kr;


        ssl_certificate      /app/nginx/conf/ssl/cert파일이름.pem;

        ssl_certificate_key  /app/nginx/conf/ssl/key파일이름.key;

        ssl_password_file    /app/nginx/conf/ssl/비밀번호파일;



        location / {

            root   html;

            index  index.html index.htm;

        }

    }