Linux

[Linux] Apache 웹서버 SSL 적용하기

로아다 2023. 9. 23. 20:05
728x90
반응형
Apache 웹서버 SSL 적용하기

- Apache SSL을 적용하기 이전에 OpenSSL을 이용하여 인증서를 발급받아야 한다.

- 해당 방법은 -> https://roajava.tistory.com/185 에서 확인 가능

 

발급받은 인증서로 적용해보자

 

1. ssl.conf 파일 편집기로 이동

vi /etc/httpd/conf.d/ssl.conf

 

2. 해당 파일에서 주석을 제거 한 뒤 ServerName(IP주소)과 DocumentRoot를 입력

<VirtualHost _default_:443>
ServerName 192.168.177.129
DocumentRoot "/var/www/html"
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

SSLEngine on

SSLProtocol all -SSLv2 -SSLv3

 

3. ssl.conf 파일에 개인키와 인증서를 등록

SSLCertificateFile /study/cert/private.crt # 인증서
SSLCertificateKeyFile /study/cert/private.key # 개인키

 

4. Apache 서버에 인증서 적용이 잘 되었는지 확인

openssl s_client -connect localhost:443 | openssl x509 -dates

 

5. Apache 서버 443 포트 열렸는지 확인

netstat -antup | grep LISTEN

 

6. 443 포트 방화벽 해제

firewall-cmd --permanent --add-port=443/tcp

 

7. Apache 실행하기

https가 적용된 것을 볼 수 있다.

 

728x90
반응형