본문 바로가기
서버/Linux

리눅스 아파치 Let's Encrypt무료 ssl 인증 방법

by redbear0077 2022. 7. 15.
반응형

리눅스 아파치  Let's Encrypt무료 ssl 인증 방법

1.인증서 설치는 standalone 방식을 이용한다.
certbot 설치

[root@main12 conf]# yum -y install certbot
[root@main12 conf]# yum -y install python2-certbot-apache

 

2.우선 웹서버를 중단시킨다. 이는 80번 포트를 사용하지 않도록 하기 위함이다.

# systemctl stop httpd

 

3.인증서를 생성한다.

# certbot certonly --standalone -d {사이트명}

예))
# certbot certonly --standalone -d test.kr

첫 번째에서 서버 관리자 이메일 주소를 입력한다.
두 번째 는  약관 동의하는 것으로 Y를 입력한다.
세 번째는 여러 수신 동의를 묻는 것으로 동의하면 Y, 거부하면 N을 입력한

 

    - 아파치 재기동

# service httpd stop

    - 인증서 생성 위치

# /etc/letsencrypt/live/{도메인}
# /etc/letsencrypt/live/test.kr

4. SSL수정

# cd /etc/httpd/conf.d/
# vi ssl.conf

 

    - 수정해야하는 위치

1.
SSLCertificateKeyFile 경로/privkey.pem
SSLCertificateFile 경로/cert.pem
SSLCertificateChainFile 경로/chain.pem
SSLCACertificateFile 경로/fullchain.pem

2.
SSLEngine on     no으로해야한다.

3.
이위치에 본인 서버 이름 추가
<VirtualHost _default_:443>
# General setup for the virtual host, inherited from global configuratio        n
#DocumentRoot "/var/www/html"
#ServerName www.example.com:443
ServerName test.kr       여기에 추가해야한다.

 

5. 443포트 열기

firewall-cmd --permanent --zone=public --add-port=443/tcp

    - 수정적용

firewall-cmd --reload

    - 열어진 포트 확인 명령어

firewall-cmd --list-all

    - 아파치 서버를 재기동

# service httpd start

빠른설정

1. [root@main12 conf]# yum -y install certbot
2. [root@main12 conf]# yum -y install python2-certbot-apache

3. [root@main12 conf]# systemctl stop httpd

4. [root@main12 conf]# certbot certonly --standalone -d vincoding.ml

5. [root@main12 conf]# systemctl start httpd

다른 putty로 열어둔다
6. [root@main12 conf]# cd /etc/letsencrypt/live/vincoding.ml

7. [root@main12 conf]# cd /etc/httpd/conf.d/
8. [root@main12 conf]# vi ssl.conf
수정
1.
SSLCertificateKeyFile 경로/privkey.pem
SSLCertificateFile 경로/cert.pem
SSLCertificateChainFile 경로/chain.pem
SSLCACertificateFile 경로/fullchain.pem

2.
SSLEngine on     no으로해야한다.

3.
이위치에 본인 서버 이름 추가
<VirtualHost _default_:443>
# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
#ServerName www.example.com:443
ServerName test.kr       여기에 추가해야한다.

9. [root@main12 conf]# firewall-cmd --permanent --zone=public --add-port=443/tcp

10. [root@main12 conf]# firewall-cmd --reload

11. [root@main12 conf]# firewall-cmd --list-all

12. [root@main12 conf]# setenforce 0

13. [root@main12 conf]# service httpd stop
반응형