CentOS 7 Apache Let's Encrypt 인증서 발급
2024. 7. 9. 01:06ㆍ카테고리 없음
안녕하세요 카트로 입니다.
CentOS 7 에서 아피치에 인증서 발급 하는 방법을 알아 볼게요

1. Certbot 설치
yum install certbot
2. Webroot 로 이동
cd /home/myhome/public_html
3. 도메인 인증서 발급
certbot certonly --webroot -w . -d mydomain.com
4. www.도메인 인증서 발급
certbot certonly --webroot -w . -d mydomain.com -d www.mydomain.com
- 인증서 발급시 소유자 인증이 되지 않아 인증파일 생성을 요구 하는 경우
mkdir /home/testhome/public_html/.well-known
mkdir /home/testhome/public_html/.well-known/acme-challenge
vi 안내된파일명
이처럼 생성 해주면 된다.
5. 인증서 발급 성공시
# 인증서 발급 성공시
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Requesting a certificate for testdomain.com
Performing the following challenges:
http-01 challenge for dooo.us
Using the webroot path /home/myhome/public_html for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/mydomain.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/mydomain.com/privkey.pem
Your certificate will expire on 2021-09-09. To obtain a new or
tweaked version of this certificate in the future, simply run
certbot again. To non-interactively renew *all* of your
certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
이와 같이 메시지가 나오게 된다.
- 인증서 남은 기간 확인
certbot certificates
- 인증서 재발급
certbot renew
- 크론탭 목록 확인
crontab -l
- 크론탭 등록
crontab -e
#실행시 vi 에디터가 열리게 된다.
0 3 1 * * /usr/bin/certbot renew --renew-hook="systemctl restart httpd"
# 입력 후 wq, 저장 후 종료