SSL이 계속 응답을 기다리고 있습니다.

SSL이 계속 응답을 기다리고 있습니다.

HTTPS를 구성하려고 하는데 작동하지 않으며 실제로 무엇이 잘못되었는지 모르겠습니다.

내가 따라온 단계는 다음과 같습니다.

  1. .pem다음을 사용하여 인증서(인증서 + 체인)를 생성했습니다.암호화하자, 다음 명령을 사용하여:

    sudo -H ./letsencrypt-auto certonly --server https://acme-v01.api.letsencrypt.org/directory

응답은 다음과 같이 옵니다.

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/xxxx.com/fullchain.pem. Your cert
   will expire on 2016-03-07. To obtain a new version of the
   certificate in the future, simply run Let's Encrypt again.
 - If like Let's Encrypt, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le
  1. 개인 키를 생성했습니다

    sudo openssl req -new -x509 -days 365 -nodes -out /etc/letsencrypt/live/xxxx.com/fullchain.pem -keyout /etc/letsencrypt/live/xxxx.com/fullchain.key

아래에 응답을 붙여넣습니다.

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:xxxx
Locality Name (eg, city) []:xxxx
Organization Name (eg, company) [Internet Widgits Pty Ltd]:xxxx
Organizational Unit Name (eg, section) []:xxxx.com
Common Name (e.g. server FQDN or YOUR name) []:test
Email Address []:[email protected]
  1. 키가 마지막 단계에서 설정한 올바른 값을 반환하는지 확인했습니다.

    sudo openssl x509 -in /etc/letsencrypt/live/xxxx.com/fullchain.pem -noout -subject

아래에 응답을 붙여넣습니다.

subject= /C=US/ST=xxxx/L=xxxx/O=xxxx/OU=xxxx.com/CN=test/
[email protected]
  1. 아래에 복사할 새 가상 호스트를 설정했습니다.

    <VirtualHost *:443>
      ServerAdmin [email protected]
      DocumentRoot /var/www/html/xxx1/public
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
      ServerName xxxx.com
      SSLEngine on
    
      SSLCertificateFile      /etc/letsencrypt/live/xxxx.com/fullchain.pem
      SSLCertificateKeyFile      /etc/letsencrypt/live/xxxx.com/fullchain.key
    
      <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
      </FilesMatch>
    
      <Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
      </Directory>
    
      BrowserMatch "MSIE [2-6]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
    </VirtualHost>
    
  2. 에서 443 포트를 열었습니다 /etc/apache2/ports.conf.

이 모든 단계를 수행한 후 sudo service apache2 restart콘솔은 다음을 얻을 때까지 기다리고 있습니다.

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

내가 디버깅하면 journalctl -xe그 결과는 다음과 같습니다.

-- Unit apache2.service has begun starting up.
Dec 08 19:12:20 devXxxx apache2[21637]: * Starting web server apache2
Dec 08 19:12:20 devXxxx apache2[21637]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 100.114.32.17. Set the 'ServerName' directive globally to suppress this mes
Dec 08 19:12:20 devXxxx apache2[21637]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
Dec 08 19:12:29 devXxxx sudo[21613]: pam_unix(sudo:session): session closed for user root
Dec 08 19:12:29 devXxxx polkitd(authority=local)[996]: Unregistered Authentication Agent for unix-process:21628:9475994 (system bus name :1.109, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loca
Dec 08 19:12:40 devXxxx apache2[21637]: *
Dec 08 19:12:40 devXxxx apache2[21637]: * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Dec 08 19:12:40 devXxxx systemd[1]: apache2.service: Control process exited, code=exited status=1
Dec 08 19:12:40 devXxxx systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has failed.

Apache가 로드를 시도하는 20초를 지켜본 후, 세부적으로 인증서를 테스트하기로 결정했습니다.

  1. 인증서가 1개만 있는지 확인합니다.

    sudo ln -s /etc/letsencrypt/live/xxxx.com/fullchain.pemsudo openssl x509 -hash -noout -in /etc/letsencrypt/live/xxxx.com/fullchain.pem.0

  2. 인증서가 작동하는지 확인:

    openssl verify -CApath f6361f65.0

하지만 놀랍게도 그렇지 않습니다.... 단말기가 응답 없이 계속 연결을 시도합니다.

누군가 나를 도와줄 수 있나요?

조언 감사드립니다.

답변1

우선, 뭔가가 이미 port에 바인딩되어 있는 것 같습니다 443.

Dec 08 19:12:20 devXxxx apache2[21637]: (98) 이미 사용 중인 주소: AH00072: make_sock: 주소 [::]:443 D에 바인딩할 수 없습니다.

다음으로, Lets Encrypt를 사용하면 고유한 개인 키를 설정할 필요가 없으며 스크립트가 사용자를 위해 하나를 생성해야 합니다(직접 CSR을 생성하지 않는 한).

스크립트가 완료 되면 letsencrypt-auto인증서 디렉터리에 4개의 파일이 있어야 합니다.

  • cert.pem- 이것은 당신의 증명서입니다. Apache에서는 SSLCertificateFile이 파일을 가리켜야 합니다.
  • privkey.pem- 이것은 귀하의 개인 키입니다. 비밀로 유지하세요. Apache에서는 SSLCertificateKeyFile이 파일을 가리켜야 합니다.
  • chain.pem- 이는 신뢰를 구축하는 인증서 체인입니다. Apache에서는 SSLCertificateChainFile이 파일을 가리킬 수 있습니다.
  • fullchain.pemcert.pem- 이는 및 의 조합 chain.pem이므로 인증서이자 전체 신뢰 체인입니다. Apache에서 SSLCACertificateFile이 파일을 가리킵니다.

문서를 암호화하자

답변2

Letsencypt의 경우 이 명령은 서버를 중지하지 않고도 작동합니다.

./letsencrypt-auto certonly --webroot -w /websitedir -d www.domain.com

nginx에 대한 이 프로세스 후에 인증서를 연결할 수 있습니다.

ln -s privkey.pem /etc/ssl/domain.key
ln -s fullchain.pem /etc/ssl/domain.crt

관련 정보