카테고리 없음

Apache HTTPS 서버 구축하기 (Ubuntu)

Wood Pecker 2022. 4. 4. 21:51

1. 개요

  https가 아니면 실행이 안되는 프로그램들이 늘어나고 있다.  기존의 http apche 서버를 https가 가능하도록 한다.

  1. 아래의 링크를 참조한다.
  2. [참고] https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04

 

Step 01. Certbot 설치

 sudo apt install certbot python3-certbot-apache

Step 02. Apache Virtual Host Configuration 확인

   서버 이름이 정확한지 채크하고 오류가 있다면 수정한다.

cd /etc/apache2/sites-available
sudo vi /etc/apache2/sites-available/000-default.conf
...
ServerName your_domain
...

  다음 파일이 존재하는지 체크해보자. 특별히 변경할 것은 없다.

sudo vi /etc/apache2/sites-available/default-ssl.conf

  configtest를 해보고 아파치를 재시작 한다. 

sudo apache2ctl configtest
sudo systemctl reload apache2

Step 03.  Certbot를 이용하여 SSL Certificate를 얻고 설정을 한다. 

sudo certbot --apache
지시하는대로 사용하고자 하는 도메인 이름을 선택하고 http를 https로 redirect 옵션을 선택한다.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://your_domain and
https://www.your_domain

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=your_domain
https://www.ssllabs.com/ssltest/analyze.html?d=www.your_domain
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Step 04. Auto-Renewal 

 Encrypt’s certificates는 90일 동안 유효하다. 그러므로 정기적으로 채크하여 자동으로 갱신을 해주도록 한다. 

sudo systemctl status certbot.timer

 reneal process를 테스트하여본다. 

sudo certbot renew --dry-run

모든 설정이 끝났다. 복잡한 과정을 참으로 편하게 설정할 수 있었다. 이런 편리한 프로그램을 개발한 제작진에 감사의 마음을 전하고 싶다. 

반응형