SSL 인증 + https (with LetsEncrypt)

https://milkye.tistory.com/337

아파치2(Apache2) SSL HTTPS 적용하기

2. 아파치에 SSL 인증서 설정하기

ssl 사용을 하겠다고 명시

$ sudo a2enmod ssl

아래 경로로 이동

$ cd /etc/apache2/sitesavailable

default-ssl.conf 파일을 원하는 이름으로 복사!

$ cp defaultssl.conf 도메인_주소ssl.conf

문서 편집기로 해당 파일을 열어서 수정을 해준다.
전체 내용이 너무 길어서 바꾼 부분만 쓴다. (주석 해재 후 수정)

$ sudo nano 도메인_주소ssl.conf //문서 편집기로 파일 열기
ServerAdmin ameeuk@gmail.com
ServerName 도메인_주소
ServerAlias 도메인_주소
DocumentRoot /var/www/test //웹문서 경로
SSLEngine on //SSL 인증서 명시
SSLCertificateFile /etc/letsencrypt/live/도메인_주소/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/도메인_주소/privkey.pem

a2ensite 명령어로 방금 수정한 파일을 site에 등록 후 아파치 재시작

$ sudo a2ensite hwanstore.mlssl.conf $ sudo service apache2 restart

“SSL 인증 + https (with LetsEncrypt)”에 대한 4개의 생각

  1. 유효기간 확인
    sudo certbot certificates

    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
    Found the following certs:
    Certificate Name: korduck.duckdns.org
    Serial Number: *************************
    Key Type: *****
    Domains: ********************
    Expiry Date: 2025-05-28 00:41:29+00:00 (VALID: 89 days)
    Certificate Path: /etc/letsencrypt/live/***********/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/***********/privkey.pem
    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

    응답
  2. * Redirect http => https

    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request’s Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName http://www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    Redirect permanent /nextcloud https://domain/nextcloud

    응답

Joinsoo에 답글 남기기 응답 취소