안녕세계

[Web] Apache에 유료 SSL 인증서 적용 (배포용) 본문

[Web] Apache에 유료 SSL 인증서 적용 (배포용)

Junhong Kim 2018. 5. 2. 15:09
728x90
반응형

Apache 웹 서버에 유료 인증서 적용 (CentOS7 기준)

CA 인증서 발급 (유료)

반드시 실서비스에는 인증서를 구매후 적용하셔야합니다.

  • 인증서 발급 절차 진행뒤 얻게되는 파일
    • ssl.key: 서버측 비공개키
    • ssl.crt: 디지털 인증서
    • ca.pem: ROOT CA 인증서
    • sub.class1.server.ca.pem: 중계자 인증서

1. Apache 설치

Apache 설치

$ yum install httpd

Apache 설치 확인

$ rpm -qa httpd httpd-2.4.6-67.el7.centos.6.x86_64

2. Apahce 실행 (root 권한)

아래 메시지가 나오면 정상입니다.
경고 메시지를 두어도 상관없지만 없애고 싶다면 여기를 참고해주세요.

# service httpd start Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

3. 경로에 인증서 발급시 얻은 파일 4가지를 옮깁니다.

위치: ~/etc/httpd/ssl

# mkdir /etc/httpd/ssl # mv [filepath] /etc/httpd/ssl/ca.pem # mv [filepath] /etc/httpd/ssl/ssl.crt # mv [filepath] /etc/httpd/ssl/ssl.key # mv [filepath] /etc/httpd/ssl/sub.class1.server.ca.pem

4. 보안을 위해 디렉토리와 파일의 권한을 수정합니다.

디렉토리와 파일 소유자는 root로 지정

$ sudo chown -R root:root /etc/httpd/ssl

파일의 권한을 600(소유자만 읽기, 쓰기 허용)

$ sudo chmod 600 /etc/httpd/ssl/*.*

디렉토리 권한을 700(소유자만 읽기, 쓰기, 실행 허용)

$ sudo chmod 700 /etc/apache2/ssl

5. Apache(CentOS)에 SSL 인증서 모듈 설치

위치: /etc/httpd/conf.d/ssl.conf

$ yum install mod_ssl

6. virtualhost를 설정합니다.

하나의 웹 서버에서 여러개의 서비스를 도메인 별로 운영할 수 있도록 돕는 Apache 기능입니다.
ssl.conf 파일에서 지시자를 다음으로 변경해주세요.

SSLCertificateFile /etc/httpd/ssl/ssl.crt SSLCertificateKeyFile /etc/httpd/ssl/ssl.key SSLCertificateChainFile /etc/httpd/ssl/sub.class1.server.ca.pem SSLCACertificateFile /etc/httpd/ssl/ca.pem

7. Apache 재시작

재시작 할 때 비밀번호를 물어보는 경우가 있는데 비공개키를 생성하는 단계에서 입력한 비밀번호를 입력하면 됩니다.

# service httpd restart

9. https 프로토콜로 접속

웹 브라우저에서 IP주소를 입력후 정상적으로 접속되는지 확인합니다.

[참고]
https://opentutorials.org/course/228/4894
https://unix.stackexchange.com/questions/263401/what-do-i-do-if-i-cant-find-ssl-conf-file-in-a-centos-server
https://kr.godaddy.com/help/apachecentos-ssl-5238
https://www.digitalocean.com/community/questions/how-to-active-sudo-a2enmod-rewrite-for-centos

https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-apache-for-centos-7 http://egloos.zum.com/guswl47/v/6514311

/ 포트 https://www.lesstif.com/pages/viewpage.action?pageId=22053128http://blog.plura.io/?p=4519

728x90
반응형

'Infra > Web' 카테고리의 다른 글

[Web] 크롬 캐시 및 쿠키 삭제  (0) 2018.12.01
[Web] Apache에 무료 SSL 인증서 적용 (개발용)  (0) 2018.05.02
[Web] HTTP와 HTTPS 그리고 SSL  (0) 2018.05.02
Comments