Apache SSL 인증서 설치 방법(ubuntu) > server

본문 바로가기
사이트 내 전체검색

server

Apache SSL 인증서 설치 방법(ubuntu)

페이지 정보

작성자 서방님 댓글 0건 조회 149회 작성일 16-02-14 04:29

본문

출처 : http://hosts.tistory.com/447


우분투 환경에서의 apache SSL 인증서 설치 방법 

 

구성 환경

* 서버환경 Ubuntu 14.10 LTS / apache 2.4

* apache2 기본 경로 : /etc/apache2/

 

* 인증서 타입 : wildcard

 

설치 방법

1. 인증서 파일 업로드


# mkdir /etc/apache2/ssl
# cd /etc/apache2/ssl
SSL 인증서 파일을  /etc/apache2/ssl 경로에 업로드

 

 

2. 인증서 파일 이름 변경(안해도 무방)
- SSL 인증서 받은 도메인이 hosts.tistory.com 일 경우 CA-1, CA-2 인증서 파일을 아래처럼 변경한다.
- CA-1,CA-2 인증서 파일 정보는 발급업체 메일 또는 파일에 명시되어 있으며 파일 이름을 변경하는 이유는

  루트 인증서와 체인인증서의 이름을 알기 쉽게 함이다.

  파일이름을 변경하지 않을 경우 "4. apache SSL 모듈 활성화" 부분의 주황과, 보라색 부분을 잘 맞춰 설정하자.

 

CA-1 정보(chanin 인증서) :  xxxxxx_CA_G3.crt -> hosts.tistory.com.chain-bundle
CA-2 정보(root 인증서)  : xxxxxx_CA.crt  -> hosts.tistory.com.com.root-bundle
key 파일 : hosts.tistory.com.key
crt 파일 : hosts.tistory.com.crt

 


3. SSL 패스워드 제거
- 해당 작업을 하지 않을 경우 Apache 서비스 재시작시 SSL 인증서의 패스워드를 넣어야 함
 
# cd /etc/apache2/ssl
# openssl rsa -in hosts.tistory.com.key -out hosts.tistory.com.key

Enter pass phrase for hosts.tistory.com.key: SSL 인증서 패스워드 입력(SSL 인증서 발급업체 메일 또는 발급받은 파일내 있음)

 

- 확인방법 : 다시한번 openssl rsa -in hosts.tistory.com.key -out hosts.tistory.com.key 명령어 실행 인증서 패스워드를 물어보지 않으면 정상적으로 제거됨

 


4. apache SSL 모드 활성화
# a2enmod ssl
# a2ensite default-ssl
# cd /etc/apache2/sites-enabled
# vi default-ssl.conf

- default-ssl.conf 파일에 SSLCertificate로 시작하는 굵은 폰트 4줄 추가

- 파랑폰트 : 서버 환경에 맞게 수정

 

<IfModule mod_ssl.c>
        <VirtualHost *:443>
        ServerName hosts.tistory.com
        ServerAdmin webmaster@localhost
        DocumentRoot /www/
        ErrorLog ${APACHE_LOG_DIR}/ssl-error.log
        CustomLog ${APACHE_LOG_DIR}/ssl-access.log combined

        SSLEngine on

        SSLCertificateFile      /etc/apache2/ssl/hosts.tistory.com.crt
        SSLCertificateKeyFile   /etc/apache2/ssl/hosts.tistory.com.key
        SSLCertificateChainFile /etc/apache2/ssl/hosts.tistory.com.chain-bundle
        SSLCACertificateFile    /etc/apache2/ssl/hosts.tistory.com.root-bundle

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>
        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
        </VirtualHost>
</IfModule>

 

 

5. apache2 설정 검증

# apachectl -t

정상일 경우 : ok
설정에 문제가 있을경우 : 문제가 있는 설정 내용 표시

 


6. SSL 인증서 적용

# apachectl restart 또는 service apache2 restart

 

SSL 인증서 적용 확인

# echo "" | openssl s_client -connect localhost:443 | openssl x509 -noout -dates

- 위처럼 입력하면 인증서 알고리즘 및 시작일/만료일이 표시된다.

 

depth=1 C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA - G3
verify error:num=20:unable to get local issuer certificate
verify return:0
DONE
notBefore=Jan  1 11:11:11 2016 GMT  -> 인증서 시작일
notAfter=Jan  2 22:22:22 2017 GMT   -> 인증서 만료일

 


 


댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
88
어제
84
최대
1,347
전체
154,459
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.