전제 조건
- 인증서를 발급할 도메인이 DNS 서버에 등록이 되어 있어야 함
(EX. 인터넷망에서 윈도우 cmd로 "nslookup 도메인" 명령 실행하면 매핑된 IP로 연결되어야 함)
- Nginx 서비스 포트 80에 대해서 방화벽 오픈이 되어 있어야 함
발급 방법
apt-get update && apt-get install -y certbot
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location ^~ /.well-known/acme-challenge/ {
allow all;
root /var/www/html; # 경로를 웹 서버 루트 디렉토리로 지정
default_type "text/plain";
}
# 나머지 서버 설정
}
nginx -t
nginx -s reload
certbot certonly --webroot -w /var/www/html -d dev.ldcc.co.kr
/etc/letsencrypt/도메인/fullchain.pem
/etc/letsencrypt/도메인/privkey.pem