차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
homeserverwithdebian:certbotandapache2 [2024/04/02 15:49] – [2. Apache2 설정] baecy | homeserverwithdebian:certbotandapache2 [2024/08/05 09:32] (현재) – [3. Certbot 설정] baecy | ||
---|---|---|---|
줄 1: | 줄 1: | ||
===== Apache Webserver HTTPS + DDNS ===== | ===== Apache Webserver HTTPS + DDNS ===== | ||
==== 1. Apache2, Certbot 설치 ==== | ==== 1. Apache2, Certbot 설치 ==== | ||
- | <codedoc code:bash> | + | <codeprism cmd=ture host=debian lang=bash> |
- | sudo apt install apache2 certbot python3-certbot-apache | + | sudo apt install apache2 certbot python3-certbot-apache</ |
- | </codedoc> | + | |
\\ | \\ | ||
==== 2. Apache2 설정 ==== | ==== 2. Apache2 설정 ==== | ||
- | <codedoc code:bash> | + | <codeprism cmd=true lang=bash host=debian> |
sudo a2enmod ssl | sudo a2enmod ssl | ||
- | sudo cp / | + | sudo cp / |
- | </codedoc> | + | |
- | + | ||
- | <codedoc code: | + | |
- | gamu.kr.conf | + | |
+ | < | ||
< | < | ||
- | | + | ServerName |
- | ServerAlias www.gamu.kr ## ServerAlias는 더 추가 가능 | + | ServerAlias www.gamu.kr ## ServerAlias는 더 추가 가능 |
- | + | ||
- | ServerAdmin webmaster@localhost | + | ServerAdmin webmaster@localhost |
- | DocumentRoot / | + | DocumentRoot / |
- | + | ||
- | ####### | + | ErrorLog ${APACHE_LOG_DIR}/ |
- | | + | CustomLog ${APACHE_LOG_DIR}/ |
- | | + | |
- | | + | SSLEngine on |
- | </ | + | |
- | </codedoc> | + | SSLCertificateFile |
- | <codedoc code:bash> | + | SSLCertificateKeyFile |
+ | < | ||
+ | SSLOptions +StdEnvVars | ||
+ | </FilesMatch> | ||
+ | < | ||
+ | SSLOptions +StdEnvVars | ||
+ | </Directory> | ||
+ | </ | ||
+ | <codeprism lang=bash host=debian> | ||
sudo a2ensite gamu.kr.conf | sudo a2ensite gamu.kr.conf | ||
- | sudo systemctl restart apache2 | + | sudo systemctl restart apache2</ |
- | </codedoc> | + | |
\\ | \\ | ||
==== 3. Certbot 설정 ==== | ==== 3. Certbot 설정 ==== | ||
- | <codedoc code:bash> | + | <codeprism lang=bash cmd=true> |
- | sudo certbot --apache | + | sudo certbot --apache |
sudo systemctl restart apache2 | sudo systemctl restart apache2 | ||
- | sudo systemctl status certbot.timer | + | sudo systemctl status certbot.timer |
- | </codedoc> | + | |
- | \\ | + | 다음과 같은 메세지 출력시에는 |
+ | <code bash cmdout> | ||
+ | Unable to find corresponding HTTP vhost; | ||
+ | Unable to create one as intended addresses conflict; | ||
+ | Current configuration does not support automated redirection | ||
+ | </code> | ||
+ | |||
+ | 이 방법으로 적용 | ||
+ | <code bash> | ||
+ | certbot certonly --standalone -d gamu.kr, | ||
+ | </ | ||
==== 4. DDNS 자동 갱신 ==== | ==== 4. DDNS 자동 갱신 ==== | ||
- | / | + | **/ |
- | <codedoc code:systemd> | + | <codeprism lang=systemd> |
[Unit] | [Unit] | ||
Description=gamu.kr & www.gamu.kr DDNS(DnsZi) Renewal Service | Description=gamu.kr & www.gamu.kr DDNS(DnsZi) Renewal Service | ||
줄 48: | 줄 61: | ||
[Service] | [Service] | ||
Type=oneshot | Type=oneshot | ||
- | ExecStart=/ | + | ## DNSZi 사이트에서 코드 발행후 입력 |
- | </codedoc> | + | ExecStart=$(type -p wget) -q -O - ' |
- | / | + | **/ |
- | <codedoc code:systemd> | + | <codeprism lang=systemd> |
[Unit] | [Unit] | ||
Description=Run DDNS(https:// | Description=Run DDNS(https:// | ||
줄 63: | 줄 76: | ||
[Install] | [Install] | ||
WantedBy=timers.target | WantedBy=timers.target | ||
- | </codedoc> | + | </codeprism> |
systemd 등록, 실행 | systemd 등록, 실행 | ||
- | <codedoc code:bash> | + | <codeprism cmd=true lang=bash> |
sudo systemctl enable gamu.timer | sudo systemctl enable gamu.timer | ||
sudo systemctl start gamu.timer | sudo systemctl start gamu.timer | ||
- | sudo systemctl status gamu.kr # 등록한 타이머 상태 확인 | + | sudo systemctl status gamu # 등록한 타이머 상태 확인</codeprism> |
- | </codedoc> | + | \\ |