해당 내용은 AWS 자습서: Amazon Linux 2에서 SSL/TLS 구성를 참고함.
$ sudo systemctl is-enabled httpd
반환된 값이 ‘enabled’ 가 아닌 경우 Apache를 시작한 다음 시스템 부팅 시마다 시작하도록 설정.
$sudo systemctl start httpd && sudo systemctl enable httpd
$sudo yum update -y
mod_ssl
을 설치해 TLS 지원을 추가$sudo yum install -y mod_ssl
/etc/httpd/conf.d/ssl.conf
/etc/pki/tls/certs/make-dummy-cert
1-1. 홈 디렉터리(/home/ec2-user
) 로 이동 후 다음 명령을 사용하여 EPEL을 다운로드
sudo wget -r --no-parent -A 'epel-release-*.rpm' https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
1-2. 리포지토리 패키지 설치
sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
1-3. EPEL 활성화
sudo yum-config-manager --enable epel*
다음 명령어로 EPEL 활성화 되었는지 확인
sudo yum repolist all
그러면 다음과 같은 정보가 반환
...
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 enabled: 12949+175
epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Debug enabled: 2890
epel-source/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Source enabled: 0
epel-testing/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 enabled: 778+12
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug enabled: 107
epel-testing-source/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source enabled: 0
...
/etc/httpd/conf.d/virtual-host.conf
를 편집한다.<VirtualHost *:80>
ServerName 도메인주소.com // 클라이언트에 보여지는 호스트 이름
ServerAlias *.도메인주소.com // 추가적인 별칭 *,? 사용가능
ServerAdmin 이메일주소 // 에러 발생 시 나타나는 관리자 메일 주소
DocumentRoot /var/www/html // 서버의 웹 문서가 있는 경로 지정
<Directory /var/www/html>
Options Indexes FollowSymlinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
sudo systemctl restart httpd
해당 절차는 Fedora, RHEL 7 에 Certbot 설치에 대한 EFF의 문서를 기반으로 합니다.
Certbot의 기본 사용 및 결과로 얻은 2048 비트 RSA 키에 기반을 둔 인증서에 대해 설명하는 자습서.
1. 먼저 Certbot 종속성 패키지 설치
sudo yum install -y certbot python2-certbot-apache
패키지 설치 완료되면 Certbot 을 실행한다.
sudo certbot
약관에 동의하기 (Y), EFF의 소식 이메일로 받기 Y,N, 마지막으로 VirtualHost 블록에 입력한 도메인명 및 주체 대체 도메인 이름을 표시하는데 이때는 그냥 Enter 누르고 진행
sudo vi /etc/crontab
39 1,13, * * * root certbot renew --no-self-upgrade
sudo systemctl restart crond