문서의 이전 판입니다!
Apache Webserver HTTPS + DDNS
1. Apache2, Certbot 설치
sudo apt install apache2 certbot python3-certbot-apache
2. Apache2 설정
sudo a2enmod ssl sudo cp /etc/apache2/sites-available/{default-ssl,gamu.kr}.conf
gamu.kr.conf <VirtualHost *:443> ServerName gamu.kr ## 추가 ServerAlias www.gamu.kr ## ServerAlias는 더 추가 가능 ServerAdmin webmaster@localhost DocumentRoot /var/www/html ####### 중략 ####### Include /etc/letsencrypt/options-ssl-apache.conf ## Certbot SSLCertificateFile /etc/letsencrypt/live/gamu.kr/fullchain.pem ## 추가한 SSLCertificateKeyFile /etc/letsencrypt/live/gamu.kr/privkey.pem ## 부분 </VirtualHost>
sudo a2ensite gamu.kr.conf sudo systemctl restart apache2
3. Certbot 설정
sudo certbot –apache ## 실행후 질문에 선택사항 입력 sudo systemctl restart apache2 sudo systemctl status certbot.timer ## 갱신 작동 확인
4. DDNS 자동 갱신
/usr/lib/systemd/system/gamu.service
[Unit] Description=gamu.kr & www.gamu.kr DDNS(DnsZi) Renewal Service [Service] Type=oneshot ExecStart=/usr/local/bin/wget -q -O - 'http://ddns.dnszi.com/set.html?user=<ddnzi-id>&auth=<dnszi-auth-key>&domain=gamu.kr&record='
/usr/lib/systemd/system/gamu.timer
[Unit] Description=Run DDNS(https://dnszi.com) Service Renewal twice daily [Timer] OnCalendar=*-*-* 00,12:00:00 RandomizedDelaySec=43200 Persistent=true [Install] WantedBy=timers.target
systemd 등록, 실행
sudo systemctl enable gamu.timer # 부팅시 타이머 실행 설정 sudo systemctl start gamu.timer # 타이머 실행 sudo systemctl status gamu.kr # 등록한 타이머 상태 확인